Ext.NET MVC – GridPanel Row Select & Get Row Value to do something
Define GridPanel from View @(Html.X().GridPanel() .ID("GridPanel") .Store( Html.X().Store() … … .Model( Html.X().Model() .Fields( new ModelField("id", ModelFieldType.Int), new ModelField("company"), … … ) ) … … ) … … .ColumnModel( Html.X().RowNumbererColumn(), Html.X().Column().Text("Company").DataIndex("company").Flex(1) … … ).Listeners(r => r.Select.Fn = "onRowSelect") .SelectionModel( Html.X().RowSelectionModel().Mode(SelectionMode.Single) ) … … JavaScript to Get the Record Key and Company Name from the GridPanel var onRowSelect = function (grid, e, rowIdx) { var record = grid.getStore().getAt(rowIdx); if(record != null) { var id = record.get("id"); var company = record.get("company"); … … } }; |