jQuery UI Widgets Forums DataTable Programmatically Clicking on Row

This topic contains 2 replies, has 2 voices, and was last updated by  Mark Hargrove 9 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Programmatically Clicking on Row #64919

    Mark Hargrove
    Participant

    I have an application with multiple tabs for searching different aspects of a database. The general form of each tab starts with an input box and a ‘search’ button. The ‘click’ event populates a dataTable via an AJAX call to a back-end REST service. In some cases, the resulting datatable allows the user to click on a row and generate another search that populates a separate datatable (but still with in the same tab).

    In some cases, clicking on a row fills in the input field on a *different* tab, then selects that tab and clicks the search button for the user. This is all working beautifully, but I have one situation I can’t figure out how to implement:

    – the user clicks on a datatable row on tab A
    – the code forces a value into the input box on tab B, selects tab B, then clicks the ‘search’ button on that tab
    – the first result table is fetched and rendered (for this particular situation there is guaranteed to be exactly one row returned from the search)
    – what I’d like to now do is to programmatically ‘click’ on the first row of that table to generate the results for a second table

    First, I cannot figure out the correct selector for the first row of that data table. If the div for the datatable is named (‘#myTable’) what is the correct selector for the first row of data?

    Second, I suspect I’ve got a race condition that I don’t know how to overcome — I obviously need the data from the AJAX query to complete before I try to ‘click’ on the datatable row. I know the loadComplete: event for the dataAdapter will help with this, but I only want to programmtically click on the first row when tab B is invoked from tab A — not when a user manually selects tab B an performs a search.

    Any suggestions?

    Programmatically Clicking on Row #64944

    Dimitar
    Participant

    Hello Mark Hargrove,

    In jqxDataTable’s API, there is a method for programmatically selecting a row (selectRow), but there isn’t one for programmatically clicking a row. We suggest you base your logic on row selection rather than row click. There is also a rowSelect event which may be helpful to you in this situation.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Programmatically Clicking on Row #65328

    Mark Hargrove
    Participant

    OK, that should work. Thanks!

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

You must be logged in to reply to this topic.