Closed nandoflorestan closed 4 years ago
I added a new npm script "serve". Don't forget to launch build or build:watch before launch serve.
And tell me if you have an issue.
For anyone else trying this out, the incantations that worked for me were:
# First clone this project, then:
npm install
npm run build
npm run-script serve
Okay, now about the demo itself, it is a bit underwhelming right now. There are only 2 data columns and 2 data rows...
The name for each demonstration is in an HTML comment right now. It should be in a h1 tag instead in order to appear on the page, too, so we'd know what is going on.
I had to replace the following line because npm installed web-animations-js in a subdirectory for me:
<script src="../node_modules/@doubletrade/lit-datepicker/node_modules/web-animations-js/web-animations-next-lite.min.js"></script>
Even after that correction, the sorting in the last demo isn't working: When I click the arrow, the arrow itself changes direction, but the table content stays the same.
Finally, I did not see any demonstration of the filter feature. It would be great to have that in the demo.
The
The sorting works with an API or a logic code inside your code. My table doesn't do any sort, you have to handle the sort event then sort the data and give them to the table.
Something like this:
<lit-datatable @sort="${this.handleSort.bind(this)}" .data="${this.myData}">
...
handleSort({detail}) {
console.log(detail);
this.myData = this.myData.sort....
}
Here's what I did.