I have 2 grids, and the second is many to one form the first grid's rows, so, whenever I load the page, I need a row selected in the first grid.
I tried to do this:
X.Call("myFunctionRowSelectJS(#{grpMyGridStore});");
but is'nt working, did I forget something? is there any alternative way in C#?
How about this:
*.aspx
<ext:GridPanel ID="grid" runat="server">
<ColumnModel>
<Columns>
<ext:Column runat="server" DataIndex="Field1" />
</Columns>
</ColumnModel>
<Store>
<ext:Store runat="server" ID="store">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="Field1" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<SelectionModel>
<ext:RowSelectionModel runat="server">
<Listeners>
<Select Handler="Ext.Msg.alert('Info', 'I was selected!');" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
</ext:GridPanel>
*.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
store.DataSource = new object[]
{
new { Field1 = "Row 1" },
new { Field1 = "Row 2" },
new { Field1 = "Row 3" }
};
store.DataBind();
RowSelectionModel selectionModel = grid.GetSelectionModel() as RowSelectionModel;
selectionModel.SelectedIndex = 0; // Select first row
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With