Try this
sm.SelectedRows.Add(new SelectedRow(id));
Note: Make sure that the variable id
is of type string
Question
I have a GridView
<ext:GridPanel ID="GridPanelRoles" runat="server" StoreID="StoreUserTypes" ForceFit="true"
Title="">
<View>
<ext:GridView ID="GridViewRoles" runat="server" LoadMask="false" />
</View>
<SelectionModel>
<ext:CheckboxSelectionModel ID="CheckboxSelectionModelMemTypes" runat="server" />
</SelectionModel>
<ColumnModel>
<Columns>
<ext:Column ID="col_type_desc" runat="server" DataIndex="description" Text="" />
</Columns>
</ColumnModel>
</ext:GridPanel>
and a store
<ext:Store ID="StoreUserTypes" runat="server">
<Reader>
<ext:JsonReader IDProperty="id" />
</Reader>
<Model>
<ext:Model ID="ModelUserTypes" runat="server" IDProperty="id">
<Fields>
<ext:ModelField Name="id" />
<ext:ModelField Name="description" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
I want to check some rows after i i fill the grid (through c#) depending on their id (id is not appear on grid). I have tried
CheckboxSelectionModel sm = GridPanelRoles.GetSelectionModel() as CheckboxSelectionModel;
sm.Select(id);
But this does not working.
I will appreciate any help.
Solution
Try this
sm.SelectedRows.Add(new SelectedRow(id));
Note: Make sure that the variable id
is of type string
OTHER TIPS
In version 3.3 you need to add
GridPanelRoles.Render();
or
sm.UpdateSelection();