Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Create an editable table with paging and filtering

Daniel_ConradiJun 3 2020 — edited Jun 3 2020

Hi,

I'm trying to setup a table with both paging and filtering using rows that have properties that are observables, but I haven't been able to find a way to do it as yet.

I've seen the JSFiddle provided in some other threads (link is https://jsfiddle.net/yxg47s1u/71/ ), but that was quite a while ago and thought there is probably a better way to do it in version 8.

Using the code below I can get the table working with paging and can edit the observable properties on the rows.

If I change it to use the ListDataProviderView from the table filtering example in the cookbook, I can get filtering working but I have to make all row properties standard properties (not observables, as the filterCriterion doesn't work with observables it seems) but then I don't have paging.

Is there some "out of the box" functionality that allows me to do both paging and filtering (if possible with observable properties)?

Provider setup in the JS file

// Base observable array to store the rows

self.dealItemsArray = ko.observableArray();

// Array data provider that wraps the observable array

self.dealItemsProvider = new ArrayDataProvider(self.dealItemsArray, { keyAttribute: 'item' });

// Paging data provider for the array data provider

self.pagingDataProvider = new PagingDataProviderView(self.dealItemsProvider);

Table setup in the html file

<oj-table id="itemTable" class="oj-flex-item" display="grid" columns.width="70" data="[[pagingDataProvider]]"

        columns="[[itemTableColumns]]">

        <oj-paging-control id="paging" data="[[pagingDataProvider]]" page-size="10" style="margin-top: 5px;"

          slot="bottom">

        </oj-paging-control>

</oj-table>

I can provide more details if required, but there should probably be some standard way of getting both paging and filtering working on a table.

Thanks,

Daniel

Comments
Post Details
Added on Jun 3 2020
0 comments
342 views