Posted in: SPARK UI Toolkit Controls
David TsaiDecember 4, 2017 at 10:46 am #4833
I have a Service Table with data loaded with sortable columns and pagination. A few of the columns in each row are buttons that use methods in the inline JS that use control.ui.getIndex() to try and grab the index of row to pass along data of it to various services. I noticed that when I paginate or sort in the table, control.ui.getIndex() doesn’t work, for example if the table has 10 records per page, if I click from page 1 directly to page 3 and click the button for the first row, it returns an index of 10. I was wondering if there’s another function I should be using to grab the index of the row where the button was clicked
DaveSPARK SupportDecember 4, 2017 at 10:52 am #4834
What you want to use is the Table control’s getRow() method (alias to getRowForView).
If the button is contained within the Table row, you can call from On Click to return the data from the row:
Stephen P.David TsaiDecember 4, 2017 at 11:35 am #4835
You may not be able to pass arguments to a custom defined function, especially when using the @method notation. However, one of the default arguments passed to custom functions is a reference to the control. This code will work if accessing the control reference combined with page.ui.get(“Table1”);
Stephen P.David TsaiDecember 5, 2017 at 8:34 am #4837
You must be logged in to reply to this topic.