Git Product home page Git Product logo

paper-datatable's Introduction

paper-datatable

A material design implementation of a data table. Let's call this a pretty solid beta.

  • Documentation can be found here
  • Demos can be found here

http://david-mulder.github.io/paper-datatable/components/paper-datatable/docs/screenshot.png

Features

  • Custom <template>'ing of every cell.

     <paper-datatable-column header="Page" property="page">
     	<template>
     		<span>{{value}}</span>
     	</template>
     </paper-datatable-column>
    
  • Two way binding directly into the paper-datatable

     <paper-datatable-column header="Page" property="page">
     	<template>
     		<paper-input value="{{value}}">
     	</template>
     </paper-datatable-column>
    
  • Extremely simple to set up (simple demo)

  • Pretty good styling support (demo)

  • Pagination and external data sources (demo)

  • Supporting both inline editing and in Material Design dialogs.

  • Add new items on the fly (unpolished demo)

  • Delightful details in sorting and partial selections. If you have ideas for more: let me know.

  • Usable on mobile. Only tested on Chrome for Android, and it's not great, but it doesn't overflow or overlap anything.

Installation

The element can be installed using bower using

bower install --save paper-datatable

Important: If you wish to use <paper-datatable-card> you need the paper elements listed in devDependencies as well. They are not listed as normal dependencies to prevent them from being pulled in on production if you do not need them.

Usage

Check out the getting started guide.

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 of the License as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

This project uses a fair share license construction, if you wish to use this project commercially you will likely want to continue reading here. If you wish to donate please contact me personally.

Contributing

I absolutely HATE rejecting pull requests, so let me just outline some advice:

  1. If you are planning on doing anything except a quick fix, it's a wise idea to open an issue first with your plans. That way we can talk it through and check whether it might not already be easily possible and whether it fits with the spirit of the component (I try to keep everything pretty declarative, generic and Polymer-y).
  2. You absolutely must make every feature you work on at least a separate commit and ideally a separate pull request. This both makes it clearer to me what is what, makes it easier to pull only the relevant parts and prevents situations where I can't give credits to the good parts, because of the bad parts.
  3. You have to explicitly agree in your pull request to the terms described in the fair share license construction.

paper-datatable's People

Contributors

david-mulder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paper-datatable's Issues

Add deselection GUI in card

Cancelling selection requires finding the selected rows now, which sucks in <paper-datatable-card>'s that support multi page selection.

Debounce `set` calls

Set calls can happen at a crazy rate if used in combination with for example a <google-map>

Creating columns for arrays?

David - thanks so much for building and sharing this element. I've found it extremely helpful in my project.

I'm struggling with implementing one of my usecases... Was hoping you could point me in the right direction.

I have a datatable mapped to an Object "results" which contains an array called "legs". Is there an idiomatic way to create a column for each item in the legs array? My first thought was to do a <dom-repeat> of <paper-datatable-columns> with custom <template>s. However, I haven't figured out how to access the each of the items within the <template>.

Is there a simple solution that I haven't found? I appreciate the guidance!

Whilst data is loading

Things to do whilst data is loading in <paper-datatable-card>:

  1. Show a progressbar
  2. Fixate header width.

Overflow question

Migrated from #39 @NamTThai

I recently found your project and it looks amazing. Just a question. I have a couple of use case when table overflow data quite easily. So how do you handle overflow in these 2 cases:

  • Overflowing vertically: Do you have a feature for freezing table header and only scrolling table body? I know that you have a feature to only display 10/20 rows but sometimes it would be great to show all the rows.
  • Overflowing horizontally: Adding too many columns and it no longer fits on viewport. How do you deal with this? Is there a bottom scrollbar for example?

Thanks for the amazing work!

Single selection not working

.splices doesn't get 'initialized' thus _isRowSelected doesn't trigger in

_isRowSelected(item, multiSelection, selectedItem, selectedItems.splices)

causing single selection to not work

Array-index property or sub-property

Do you support data binding with array index or sub-property? Say I have this data object:

[
  {
    "id": 1,
    "infoArray": [a, b, c],
    "infoObject": {
      "prop1": "var1"
    }
  }
]

and I want to build a table like this:

<paper-datatable data="{{data}}">
  <paper-datatable-column header="Info Array" property="infoArray.0"></paper-datatable-column>
  <paper-datatable-column header="Info Object" property="infoObject.prop1"></paper-datatable-column>
  <paper-datatable-column header="Info Array2" property="infoArray[0]"></paper-datatable-column>
</paper-datatable>

Add filtering capability to paper-datatable

It would be great to add a filtering option to the component ร  la datatables.net. It would probably be an implementation of the native filter(), but it would be nice if paper-datatable-column had a filterable attribute that indicated if you wanted to filter on thiat column or not.

Firebase intagration

If you use Firebase, then when editing rows in the table after the first editing, breaks "focus" or "binding"
Imgur

Data changes do not get properly notified upwards

Not sure what's happening, but since the update to Polymer 1.2 data changes on arrays do not get properly notified upwards as can be seen in the demo/datatable.html demo at the bottom of the page.

TypeError when underlying property for paper-datatable-column is undefined.

<paper-datatable-column header="My Header" property="myproperty"></paper-datatable-column>

If myproperty is undefined in any row, following TypeError causes all the subsequent rows to be left unrendered.

TypeError: Cannot read property 'toString' of undefined
    at paper-datatable-column.Polymer._cast (paper-datatable-column.html:331)
    at paper-datatable-column.Polymer._formatValue (paper-datatable-column.html:289)
    at paper-datatable.<anonymous> (paper-datatable.html:595)
    at Object.Debouncer.complete (polymer.html:1227)
    at Object.Polymer.Async._atEndOfMicrotask (polymer.html:1184)
    at MutationObserver.window.MutationObserver.observe.characterData (polymer.html:1199)

I believe following code in paper-data-column._formatValue should be moved up before call to _cast.

if(typeof data == 'undefined'){
    return '';
}

`selectAll` only selects items on current page

Per title, problem is that selecting all items would require a new function on the data-source that requests all ids~ Relatively easy to do when using the ids->getByIds approach, harder with just the get approach.

How to set length of dataSource after ajax request

Hi,

I can't find out how to set the length of a dataSource after I made an ajax request. Could you give me a hint or is this not implemented yet?

I tried

length: function () {
    return new Promise( function ( resolve, reject ) {
        resolve(500);
    } );
}

self.dataSource.length = 500;
self.dataSource.set( 'length', 500 );
self.dataSource.set( 'numberOfItems', 500 );
self.$.datatable._setNumberOfItems( 500 );

Thanks for your help

Greetings Kersten

How to pass format-value a function inside a customer Polymer element?

example:

<paper-datatable-column ... format-value="[[formatValue]]" ...> </paper-datatable-column>
Polymer({
    is: "xyz",
    ...
    formatValue: function(value){
      return (this._isNumeric(value) ? Number(value).toLocaleString("en-US") : value );
    }
});

It won't overwrite the default implementation for formatValue in paper-datatable-column.html.

Implement weakCache.js again

Would be neat to cache items whilst browsing in <paper-datatable-card>. Sad part is that a real weak cache isn't possible yet in modern browsers, but it looks like this will be coming at some point in the future, so implementing weakCache.js would create a nice basis to have strong caching for now and an easy layer to set up weak caching later.

Show sort indicator on hover

It's a bit hidden in the material design spec, but on :hover an indicator should be shown that a column is sortable.

Show `<paper-datatable-column>` inside or on top of `th`

This is a lot harder than it sounds, as

  1. The columns need to register (attach) before table generation can start
  2. But <th> are located inside the generated table

so you get a bit of a paradox, which could be solved by just showing them on top of the th's.

Doesn't work in Edge

Edge debugger is super crappy, so not sure what's happening, but:

Unable to get property 'title' of undefined or null reference

Somewhere in paper-datatable.html.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.