Pagination via $tm1uiTable


#1

Hey,

Is there a way to change the default page size of 10 when using $tm1uiTable?

Or would we need to create our own pagination function?

Cheers

Jack


#2

Hi Jack,

Yes you can:


$tm1UiTable.create($scope.page.accounts, {pageSize: 20});

// Full options
options: {
	index: 0,             // Index of the page, i.e. page 1 = 0, page 2 = 1, etc.
	pageSize: 10,         // Maximum number of items per page
	sortType: null,       // Field to sort on or a function, i.e. "Name" or function(item){ ... }
 	sortReverse: false,   // Reservse the sort
	filter: null,         // Filter the returned result, a function works best here
	preload: true,        // If true all items are returned from the table.data() function but ng-show="table.show(account, $index)" will return false. If preload=false only the items in the page will be returned, false is the equivalent of using ng-if and is faster with lots of record, any DBRs will be lazy loaded.
	watch: true           // Watch the array for changes and automatically update the list
}

#3

Hey Tim,

Thanks for this, does exactly what we need.

Just a quick question on preload: true - i set it as false for a table but Canvas only loads the 1st page, and when you use a button to navigate to the next page, no data is returned?

Is there something else that needs to be set?

Jack


#4

Hi Jack,

Check out the salary budget html/js in the samples. It is uses the preload: false option.


#5

Hey Tim,

Thanks for this, needed to create a filter in the controller as per the budget example in samples rather than using Angular’s built in filters for each page to render (if anyone else experiences the above).

Jack