This is a migrated thread and some comments may be shown as answers.

[Solved] RowSelected with Groups

1 Answer 45 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
MGrassman
Top achievements
Rank 2
MGrassman asked on 20 Sep 2010, 09:40 PM
I have the following function that works fine when grouping is turned off.

function gridLocationTypes_onRowSelected(e) {
            var grid = $(e.row).parents('.t-grid').data('tGrid');
            var data = grid.data[$(grid.$tbody[0].rows).index(e.row)];
            var id;
            //for (x in grid.dataKeys)
            var marketId = data['MarketId'];
            var parentZoneId = data['ParentZoneId'];
            var zoneName = data['ZoneName'];
            
            $("#Zone_MarketId").data('tComboBox').value(marketId);
            //$("#Zone_ParentZoneId").data('tComboBox').value(parentZoneId);
            $('#Zone_Name').val(zoneName);
            BindParentZoneComboBox(marketId, parentZoneId);
        }


When grouping is turned on it counts the group headers as a row so if there are 2 groups the last two items in teh grid don't works when selected.

Any suggestions?

1 Answer, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 21 Sep 2010, 08:38 AM
Hello MGrassman,

You can use dataItem() method, which will get the correct data item:
function gridLocationTypes_onRowSelected(e) {
            var grid = $(e.row).parents('.t-grid').data('tGrid');
            var data = grid.dataItem(e.row);
            var id;
...

Greetings,
Georgi Krustev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
MGrassman
Top achievements
Rank 2
Answers by
Georgi Krustev
Telerik team
Share this question
or