Wrong reference in filtered rgrid

The place to get advice and support about rGrid

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 72
Joined: Tue Mar 05, 2013 7:00 pm
Location: Berlin

Wrong reference in filtered rgrid

Post by mimu » Mon Dec 14, 2015 6:15 pm

setting a filter using:

on rawKeyUp
set the '["filter column 1 of sheet 1"] of grp "rGrid" to "with *" & me & "*"
send "render" to grp "rGrid"
end rawKeyUp

works fine.

But when i try to copy cells in the filtered grid or
i try to
put the '["hilitedRows"] of grp "rGrid" into int ttest
put the '["values of row "&ttest&""] of grp "rGrid" into tdata

i still get the values of row 1-3 in tdata.
(row 1 - 3 is hilited, the filtered grid shows row 4-5)

What would be the easiest way to access the shown data?

Livecode Opensource Backer
Livecode Opensource Backer
Posts: 37
Joined: Tue Jun 01, 2010 10:37 pm

Re: Wrong reference in filtered rgrid

Post by djkesler » Tue Jan 19, 2016 4:36 pm

I don't know if you ever got past this problem in rGrid.

In the situation you described it appears that rGrid is doing exactly what it was asked to do, i.e. copy the hilited lines. What you want to do is copy the lines that were filtered. Unfortunately, there is not a way to do that in the current version. There is not a command to even reveal the rows that survived the filtering.

However, if you are brave enough to add a command into the rgrid engine behavior button, you can get a list of all the rows that are shown in the filtered grid. Actually the command below will give a list of rows that can be seen with scrolling whether filtered or not.

Add this text to the button "rGridBehavior" script:
command visibleRows
return sFilteredRowIDs
end visibleRows

Then when you need at list of filtered rows you would use something like:

send "VisibleRows" to grp "rGrid" -- or whatever the name you have give the grp instead of "grid"
put the result into vRows -- vRows will contain a CR delimited list of line numbers that are visible

With the list of rows you should be able to do what you want with the information.
Hope this helps.


Return to “rGrid”