Search Support
-
Navin AgarwalApril 20, 2018 at 4:26 am #5111
Hi,
I have used Table Conrol and the first column in the table is row number of table .There is a filter/search function available on the table and the requirement is to show the row number as they are in filtered table rows displayed.
I was using me.ui.getIndex() method but that always returns the index as it was in original table . Are you able to suggest how I can display the row number as it is in filtered table ?
Thanks.
SPARK SupportApril 20, 2018 at 1:39 pm #5117Hi Navin,
The getIndex() method of UI provides the index for the row of the UI when it is loaded. When the Table is sorted, the rows are redrawn, and thus the indexes are updated for their current position.
I would suggest adding a Record Number property to your Business Object and programmatically populating the column before loading the data in the Table.
Regards,
Stephen P.
Navin AgarwalApril 23, 2018 at 7:54 am #5118Hi Stephen,
Thanks for your response.
Yes indeed there is an attribute in the business object for rownumber. This was getting set on the server-side but as the filter runs client-side, the row numbers were getting out of sequence after filter. However I have now programatically set it as you advised after filter using the code below. Not sure if this the best way of doing this but would be good to get your advise. Thanks
this.filterTasks = function(so)
{
this.ui.get(“Table_Control”).search(this.filterTask); // run filter
var records = this.ui.get(“Table_Control”).getRecords(true); // get filtered records listfor(var i=0;i<records.length;i++)
{
var recIndex = this.ui.get(“Table_Control”).getRecordIndex(records[i])//this.ui.get(“Table_Control/rowNumber[“+ recIndex +”]”).setText(i+1); // this didn’t work on pagination so I used binding to set value
this.context.binding.get(“value”).get(recIndex ).set(“rowNumber”, i+1);
}
this.ui.get(“Table_Control”).setPageSize(searchOptions.numberOfResults);
} -
|
You must be logged in to reply to this topic.