当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Ext.net How to check row GridPanel with CheckboxSelectionModel

问题描述:

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.

网友答案:

Try this

    sm.SelectedRows.Add(new SelectedRow(id));

Note: Make sure that the variable id is of type string

网友答案:

In version 3.3 you need to add

GridPanelRoles.Render();

or

sm.UpdateSelection();
分享给朋友:
您可能感兴趣的文章:
随机阅读: