Page 1 of 1

dgHilitedIndexes and dgHilitedLines in data grids

Posted: Fri Mar 07, 2014 5:46 am
by keram
Hi,

I need to clarify this question:

When a data grid is populated with let's say 100 lines each line gets an Index number which is dgHilitedIndexes when it's highlighted (suppose it's 17). Then if I sort out some of the lines and the remaining lines will populate the same data grid, will the same line K in the 2nd view when highlighted have the same Index number 17 as in the previous 1st view?

So far my understanding (maybe wrong) was that that the Index numbers of highlighted lines are fixed and Line numbers (dgHilitedLines) are changing according to what view the lines end up in. But I'm facing a problem with my dg that made me think it may not be so.

Can someone clarify?
Thanks.

keram

Re: dgHilitedIndexes and dgHilitedLines in data grids

Posted: Fri Mar 07, 2014 6:05 pm
by keram
OK, no one responded...
Maybe my question is too complex or complicated?

So instead I posted a new topic showing practically how this problem shows up in a data grid. Here is the link:
http://ftp.runrev.com/forums/viewtopic.php?f=7&t=19476

keram

Re: dgHilitedIndexes and dgHilitedLines in data grids

Posted: Fri Mar 07, 2014 7:22 pm
by dunbarx
Hi.

Except for Trevor deVore, most helpers need to think a bit about DG issues. I use them, but usually like to make a test on an actual gadget before I am comfortable answering a question. Someone will chime in...

Craig

Re: dgHilitedIndexes and dgHilitedLines in data grids

Posted: Sat Mar 08, 2014 12:01 am
by Zryip TheSlug
keram wrote:Hi,

I need to clarify this question:

When a data grid is populated with let's say 100 lines each line gets an Index number which is dgHilitedIndexes when it's highlighted (suppose it's 17). Then if I sort out some of the lines and the remaining lines will populate the same data grid, will the same line K in the 2nd view when highlighted have the same Index number 17 as in the previous 1st view?

So far my understanding (maybe wrong) was that that the Index numbers of highlighted lines are fixed and Line numbers (dgHilitedLines) are changing according to what view the lines end up in. But I'm facing a problem with my dg that made me think it may not be so.

Can someone clarify?
Thanks.

keram
Hi Keram,

The question is more relatives to usage of arrays than usage of datagrids.

The dgIndexes of a datagrid are no more no less the keys you are preparing in the array used for populating the datagrid by using dgData.

Let's take an example with a datagrid of one key "myValue" composed by 5 rows:

dgData[index][key]

line 1 = dgData[1]["myValue"] -> A
line 2 = dgData[2]["myValue"] -> C
line 3 = dgData[3]["myValue"] -> B
line 4 = dgData[4]["myValue"] -> E
line 5 = dgData[5]["myValue"] -> D

the indexes sequence is: 1,2,3,4,5

If we are sorting the myValue by text ascending:

line 1 = dgData[1]["myValue"] -> A
line 2 = dgData[3]["myValue"] -> B
line 3 = dgData[2]["myValue"] -> C
line 4 = dgData[5]["myValue"] -> D
line 5 = dgData[4]["myValue"] -> E

the indexes sequence is: 1,3,2,5,4

The order of the keys changes, but the association index + value is the same.
Behind the index 5 we still have D, etc.

If we want to populate a datagrid with indexes 2 and 5 we just have to collect the data behind the indexes and we can preserve the same indexes if we want:

put tDataArray1[2] into tDataArray2[2]
put tDataArray1[5] into tDataArray2[5]

set the dgData of grp "myDataGrid" to tDataArray2

Content of the first datagrid:
line 1 = dgData[1]["myValue"] -> A
line 2 = dgData[3]["myValue"] -> B
line 3 = dgData[2]["myValue"] -> C
line 4 = dgData[5]["myValue"] -> D
line 5 = dgData[4]["myValue"] -> E

Content of the second datagrid:
line 1 = dgData[2]["myValue"] -> C
line 2 = dgData[5]["myValue"] -> D


Best Regards,