datagrid: when sort by text column datagrid add many empty rows

Bob Sneidar bobs at twft.com
Fri Mar 11 13:46:16 EST 2011


Seems you have empty rows or rows with no data in the column you are sorting by. To determine if this is true, get the dgText of the datagrid, and examine it either in the debugger or else by putting it in a scrolling field. 

I made a custom sort function that sorts rows with a particular value to the top, another value second, empty third. Before I sort however, I remove rows that are all blank, that have nothing in any of the columns. 

    -- find and remove blank lines
    put false into foundBlanks
    repeat forever
        dispatch findIndex to group "dgMerge" with \
                "PriFields",empty,"SecFields",empty
        put the result into theResult
        if theResult is 0 then exit repeat
        put true into foundBlanks
        dispatch deleteIndex to group "dgMerge" with theResult
    end repeat

Obviously you will have to modify this for your own columns, and with a little more work you can even make this generic for all datagrids. 

Bob


On Mar 11, 2011, at 9:35 AM, JosepM wrote:

> Hi,
> 
> I detected that when I order by a column that is defined as text and scroll
> down to the last row many many empty rows are added and cause that only the
> last row left visible on top of the datagrid and the rows scroll without
> moving it, if you scroll up again the rows after pass the empty ones appear
> again.
> If I order again with a number col the behaviour is normal again.
> 
> Any idea why? a bug?
> 
> 
> Salut,
> Josep M
> 
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/datagrid-when-sort-by-text-column-datagrid-add-many-empty-rows-tp3348673p3348673.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list