jQWidgets Forums
jQuery UI Widgets › Forums › Grid › how to get bound index for 'getselectedrowindexes'
Tagged: datagrid rows
This topic contains 5 replies, has 2 voices, and was last updated by stephan 11 years, 9 months ago.
-
Author
-
Hi,
My question is: How can I get or calculate the bound index for the index values returned by ‘getselectedrowindexes’ ?
I am having problems with a table that is both filtered and sorted.
From what I have seen in my tests the ‘getselectedrowindexes’ function does not return the bound index, and it does not return the visible index either. Calling ‘getrowboundindex’ on an index returned by ‘getselectedrowindexes’ gives an incorrect result. I tested calling ‘getrowboundindexbyid’ with the indexes returned by ‘getselectedrowindexes’, but this also gave incorrect results.
To the best of what I can see from debugging the function ‘getselectedrowindexes’ returns the index of the row within an array of data where filtering is applied, but where sorting has not been applied. I can not find an API function that would return this kind of array. Therefore my attempts at resolving the index myself were not successful.
I did have a look at what ‘getrowdata’ returns. It returns an array of the correct content (ie. size), but this array has both filtering and sorting applied and so can not be used for resolving the indexes returned by ‘getselectedrowindexes’.
Regards,
StephanHi Stephan,
– ‘getrowboundindexbyid’ works with row ids, not row indexes.
– ‘getboundrows’ returns the Array with the rows loaded into the Grid. That array is not affected by sorting or filtering operations.Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter,
Yes, but how do I get the bound index for the index values returned by ‘getselectedrowindexes’ ?
Basically I understood what all those array represent, but the description of ‘getselectedrowindexes’ does not state what type of index it returns. It seems to me like it does not match up with any of the array getters, and it does not match up with any of the “bound” getters either.
So my problem still is: I call ‘getselectedrowindexes’ and I must convert this into bound index values, so that I know which if my data records from the original data source are selected.
Regards,
StephanHi,
I created a small fiddle to show you the problem that I am attempting to resolve:
http://jsfiddle.net/_stephan_/dGauq/2/In the grid select the first row “Bellini” with your mouse, then click on “Show Selection Info”. It will output an index of 2, which is what ‘getselectedrowindexes’ returns.
My problem is: how do I find the corresponding data for ‘2’ in my original bound data source, ie. within the original array ?
All API functions of jqxGrid that I investigated do not appear to allow resolving an index of ‘2’ into the correct data record for “Bellini”. But maybe I am doing something wrong ? Please help.
Reegards,
StephanHi,
Could you please look into my question ?
For a sorted and filtered grid ‘getselectedrowindexes’ returns index values that do not seem to match or correspond with any of the arrays or lists associated with the grid. Thus I do not know how to convert the value properly into the corresponding record from the original data source.
I posted a fiddle above to illustrate my problem.
Thanks and Regards,
StephanAnd Hi again,
I herewith close my own thread, so to speak
Just to make sure I posted everything correctly I clicked on my fiddle …. and a miracle happened ! Instead of returning the rather strange index of 2 it now returns 5, which is fantastic, because it appears to be the bound index. Further research uncovered that the cause for the miracle is in fact a new version of jQWidgets (namely version 3.0) which apparently includes this small but very helpful fix.
Thanks for all the good work
Stephan -
AuthorPosts
You must be logged in to reply to this topic.