Welcome Guest Search | Active Topics | Sign In | Register

Grid: issue with ClientSideOnItemSelected Options
Roger Jordan
Posted: Wednesday, December 11, 2013 3:04:45 AM
Rank: Member
Groups: Member

Joined: 12/29/2008
Posts: 29
Hello,

I use a Grid with some sortable columns.

The event ClientSideOnItemSelected fires when the header of a sortable column is clickt. The item index is 0 in this case, so it seem as the first data row was clickt. Is this a bug? Or how to identify that not a data row is clickt? FullRowMode is set to true.


Thanks for your help.

Best regards,
Roger


eo_support
Posted: Wednesday, December 11, 2013 9:52:02 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

ClientSideOnItemSelected will be fired after a column is sorted if there was already an selected item. This was done on purpose so that your code will have a chance to be updated about the new row position of after sort. For example, if before the sort item #2 was the selected item and after sort it became item #6. Then ClientSideOnItemSelected will be fired so that you can call getSelectedItem().getIndex() to determine the new item position.

ClientSideOnItemSelected will not be fired if there was no selected item before the sort.

Thanks!
Roger Jordan
Posted: Wednesday, December 11, 2013 11:37:09 AM
Rank: Member
Groups: Member

Joined: 12/29/2008
Posts: 29
Hi, yes, that is exactly what I see.

I tried do make the grid to be able for selecting multible rows. Therefore I put a Checkbox column inside and don't want to force the user to click exactly the checkbox to select/unselect one of the rows. So each time ClientSideOnItemSelected fires I raise grid.raiseItemCommandEvent to change the checked status of this row on Server side. That seems to work fine.
But when the user click on a sortable row header ClientSideOnItemSelected fires and therefore the checkbox status of the last selected row changes, but that should not happen.
Whould it be OK to set
Grid1.SeelctedItemIndex = -1
each time on grid.raiseItemCommandEvent? I think that than ClientSideOnItemSelected will never fire on a click on a row header.

Maybe there is an easy way to make the grid able to multiselect rows and I did not notice.

Best regards,
Roger
eo_support
Posted: Wednesday, December 11, 2013 2:01:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

No. We can't change SelectedItemIndex to -1 because other users will want to keep the selected item index on such cases. You probably want to add some code to check whether the item's checked state has changed since last raiseItemCommandEvent so that you can skip the call if it's just a sort.

Thanks!
Roger Jordan
Posted: Wednesday, December 11, 2013 3:03:46 PM
Rank: Member
Groups: Member

Joined: 12/29/2008
Posts: 29
Sorry for misunderstanding, I don't want you to set SelectedItemIndex to -1, I want to do this in my own code in Server side Event OnItemCommand. This seem to work for me. So I never have a selected item and no Client Event will fire up on sort. Hope that this will not cause any side effects.

Best regards,
Roger
eo_support
Posted: Wednesday, December 11, 2013 3:40:29 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Oh I see! Thanks for the clarification!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.