ralph78fr
01-09-2007, 02:19 AM
Hi everyone!
I am currently fighting with grids and checkboxes. I saw several thread dealing about this, but could not find any help in the answers.
I merely want to have a grid with a checkbox to "select/unselect" rows. I already wrote some code to send the "selected" rows to the server, and this part seems to work.
On the other hand, the "normal" behavior of the checkbox and/or the grid doesn't look so normal to me.
the grid is bind to a simple dataset like
<my_ds>
<item id="1" txt="aaa" def_select="false"/>
<item id="2" txt="bbb" def_select="false"/>
<item id="3" txt="ccc" def_select="false"/>
</my_ds>
and looks like
<grid datapath="my_ds:/my_ds[1]" contentdapath="item">
<gridcolumn><checkbox datapath="@def_select"/></gridcolumn>
<gridtext datapath="@txt"/>
</grid>
the data seem to be ok (the checkboxes are checked if def_select is true, unchecked else).
but there are 2 major problems:
1) if I sort the txt column, the checkboxes looks independant. for instance, i run my app, everything is unchecked. Then i check "aaa" and sort the txt column. as a result, "ccc" will look checked, since the list will be upside down.
2) when I put more items (enough to have 2 times more items than displayed by the grid), some items will be checked as if they were paired.
(for instance, everything is unchecked, I check "aaa", scroll down and notice "kkk" has been checked as well. If i uncheck "kkk", "aaa" will be unchecked as well.
it'll be the same for "bbb" and "lll", "ccc" and ""mmm" and so on.
so if anyone experienced this before, i'll be pleased to share his knowledge.
(i really hope i did something wrong, since "sorting items" is a requisite in my project, and the 2nd problem is obviously blocking.
best regards,
Raph
I am currently fighting with grids and checkboxes. I saw several thread dealing about this, but could not find any help in the answers.
I merely want to have a grid with a checkbox to "select/unselect" rows. I already wrote some code to send the "selected" rows to the server, and this part seems to work.
On the other hand, the "normal" behavior of the checkbox and/or the grid doesn't look so normal to me.
the grid is bind to a simple dataset like
<my_ds>
<item id="1" txt="aaa" def_select="false"/>
<item id="2" txt="bbb" def_select="false"/>
<item id="3" txt="ccc" def_select="false"/>
</my_ds>
and looks like
<grid datapath="my_ds:/my_ds[1]" contentdapath="item">
<gridcolumn><checkbox datapath="@def_select"/></gridcolumn>
<gridtext datapath="@txt"/>
</grid>
the data seem to be ok (the checkboxes are checked if def_select is true, unchecked else).
but there are 2 major problems:
1) if I sort the txt column, the checkboxes looks independant. for instance, i run my app, everything is unchecked. Then i check "aaa" and sort the txt column. as a result, "ccc" will look checked, since the list will be upside down.
2) when I put more items (enough to have 2 times more items than displayed by the grid), some items will be checked as if they were paired.
(for instance, everything is unchecked, I check "aaa", scroll down and notice "kkk" has been checked as well. If i uncheck "kkk", "aaa" will be unchecked as well.
it'll be the same for "bbb" and "lll", "ccc" and ""mmm" and so on.
so if anyone experienced this before, i'll be pleased to share his knowledge.
(i really hope i did something wrong, since "sorting items" is a requisite in my project, and the 2nd problem is obviously blocking.
best regards,
Raph