jQWidgets Forums

jQuery UI Widgets Forums Grid Get the row index via the row id

This topic contains 1 reply, has 1 voice, and was last updated by  Klaus H 12 years, 2 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Get the row index via the row id #19050

    Klaus H
    Participant

    Hello,

    I want to use the grid to let a user update data in a grid and store it in the database. But the saving mechanism is not triggered on the update row, because the user wants to apply all the changes and save after the changes are complete.

    I store the row ids in an array and want to access the rowdata of the rows now. For that (getrowdata) I need the corresponding row index. But I don’t see any way to get the row index of a row id, in your examples you always use the getselectedrow function, but in my case the row is not selected any longer and I can’t select a row by the row id, I would need the row index for that.

    I could save the row index together with the row id in the updaterow callback, but if I am not mistaken the row index changes with sorting and filter options, which are active in the grid.

    So, is there any way to get the rowdata or the row index with just the id?

    Regards
    Klaus

    Get the row index via the row id #19083

    Klaus H
    Participant

    I guess I have a solution, I remove all filters and use the getrows method to iterate over the rows and compare with getrowid if that entry is in my array. That is quite faster than I thought. Then I can retrieve the data, send my request and update an indicator in the row that the row was saved (before it was flagged as is not saved).

    I used the updaterow function, but that somehow did not refresh my indicator field via the cellrenderer (the old value was still set). So I ended up deleting the row and adding it again. It ended up at the same position, so that was fine. I guess that was due to the fact that the id is a number and the initial sort is on the key. Is there any way I can give a position for the addrow function just to be sure?

    I also tried applying a manual filter on my indicator and only getting those rows. That worked, but the deleterow always returned false for no apparent reason. But as I said the other solution works.

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

You must be logged in to reply to this topic.