• David Tsai
    December 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

    Thanks

    Dave

    SPARK Support
    December 4, 2017 at 10:52 am #4834

    Hi David,

    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:

    view.getRow(me).getData()

    https://support.salientprocess.com/docs/enterprise/Table.html#getRowForView

    Regards,

    Stephen P.

    David Tsai
    December 4, 2017 at 11:35 am #4835

    Does this work for Service Data Tables as well?  The button is contained within the Table row and when I pass in view.getRow(me).getData() into the method called within the inline javascript of the coach view and console log one of the attribute in the data, its returning undefined for me

    SPARK Support
    December 4, 2017 at 3:27 pm #4836

    Hi David,

    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”);

    Regards,

    Stephen P.

    David Tsai
    December 5, 2017 at 8:34 am #4837

    Thanks Stephen!  I was able to get it to work with getRow and using the reference to the  control in the inline javascript.  This method also worked to fix the same issue when we have sortable columns on service tables.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Start typing and press Enter to search