Get CheckboxGridPanel selected rows values, v3.4.0 ?
I'm using Ext.net 1.2 == ExtJs 3.4.0
I wanna add the selected values (Filter with Name, Lname) to an ext's textbox.
I searched , and I could find the below codes, but now I don't know how I can add the the values from var values in JavaScript to an ext's textbox.
Code:
<script type="text/javascript">
function AddUser() {
var values = GridPanel1.getRowsValues(
{
filterField: function (record, fieldName, value) {return fieldName == "Name" || fieldName == "Lname";},
selectedOnly: true,
currentPageOnly: false
});
////this method should be complete
}
</script>
<div style="width: 500px; margin: 0 auto;">
<ext:Store ID="Store1" runat="server" OnRefreshData="Store1_RefreshData">
<Reader>
<ext:JsonReader IDProperty="ID">
<Fields>
<ext:RecordField Name="ID" Type="Int" />
<ext:RecordField Name="RowNumber" Type="Int" />
<ext:RecordField Name="Name" />
<ext:RecordField Name="Lname" />
<ext:RecordField Name="EnterprisePosition" />
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<br />
<ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" StripeRows="true"
Title="Result" Collapsible="true" StyleSpec="width:95%; margin:0 auto;"
Height="350" Collapsed="true">
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ColumnID="RowNumber" Header="Row" Width="50" Resizable="false" MenuDisabled="true"
Fixed="true" DataIndex="RowNumber" />
<ext:Column ColumnID="Name" Header="Name" Width="100" DataIndex="Name" />
<ext:Column Header="Last Name" Width="150" DataIndex="Lname" />
<ext:Column Header="Position" Width="160" DataIndex="EnterprisePosition" />
</Columns>
</ColumnModel>
<BottomBar>
<ext:PagingToolbar ID="PagingToolBar1" runat="server" PageSize="10" StoreID="Store1"
DisplayInfo="false" />
</BottomBar>
<SelectionModel>
<ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server">
<Listeners>
<RowSelect Fn="AddUser" /><!-- ******** -->
</Listeners>
</ext:CheckboxSelectionModel>
</SelectionModel>
</ext:GridPanel>
</div>
Could you please guide me ? Thanks
how to get values from Grid rows
well....I dont know abt extjs 3.4 version
but m using extjs4.0 and at first I got the same problem..........but now here is the solution
try it in ur code
put this particular code : where u want to call the form component
for example:
I want this value when I check the row and click on EDIT button:
So this code has to cum inside the
Code:
buttons:[{
text: 'EDIT',
handler: function{
var sm = Ext.getCmp('grid_ID').getSelectionModel();
var rec=sm.getLastSelected();
// for name and last name get the values from grid Selection
first_name = rec.get("first_name");
last_name = rec.get("last_name");
}
}]
through this u get the value of NAME n LNAME
now put value: first_name and value: last_name where u have given :
Code:
xtype: 'textfield',
id: 'first_name',
name: 'first_name',
fieldlabel: 'First Name',
value : first_name
n same for last name:
Code:
xtype: 'textfield',
id: 'last_name',
name: 'last_name',
fieldlabel: 'Last Name',
value : last_name
I wanna all selected rows
Thanks for your reply.
You wrote in your code :
PHP Code:
var rec=sm.getLastSelected();
That give us only the last selected row details, whereas I wanna get all selected rows' values !!!
How can I get all selected rows' values ? :-/