Hello All,
I have a problem with datagrid (not edatagrid) inline row editing, i try to modification easyui datagrid tutorial
http://www.jeasyui.com/tutorial/datagrid/datagrid3.phpMy question is:
1. how can i get all checked row to array including numberbox, textbox and combobox value ?
2. post them to PHP ?
3. Parse the array ini PHP, so i can insert them to Database.
Please Help Me,
Thanks.
HTML
<table id="dg" class="easyui-datagrid" style="width:600px;height:250px"
url="data/datagrid_data.json"
title="Load Data" iconCls="icon-save" fitColumns="true"
idField="itemid">
<thead>
<tr>
<th field="ck" width="80" checkbox="true">Item ID</th>
<th field="itemid" width="80">Item ID</th>
<th field="productid" width="80">Product ID</th>
<th field="listprice" width="80" align="right">List Price</th>
<th field="unitcost" width="80" align="right" data-options="editor:'numberbox'">Unit Cost</th>
<th field="attr1" width="150" data-options="editor:'textbox'">Attribute</th>
<th field="statusName", data-options="align: 'center',
editor:{
type:'combobox',
options:{
valueField:'statusId',
textField:'statusName',
panelHeight:'auto',
data: [{
statusId: '',
statusName: '- Choose -'
},{
statusId: 'true',
statusName: 'Active'
},{
statusId: 'false',
statusName: 'Non Active'
}]
}
}
" width="80"><b>Status</b></th>
</tr>
</thead>
</table>
Javascript
<script>
function save() {
var ids = [];
var rows = $('#dg').datagrid('getSelections');
for(var i=0; i<rows.length; i++){
ids.push(rows[i].itemid);
}
alert(ids.join('\n'));
}
$(document).ready(function () {
var lastIndex;
$('#dg').datagrid({
onLoadSuccess: function(data) {
$('#dg').datagrid('getPanel').find('div.datagrid-header input[type=checkbox]').attr('disabled','disabled');
},
onCheck: function(index,row){
if(lastIndex != index) {
$(this).datagrid('beginEdit', index);
}
},
onUncheck: function(index,row){
if(lastIndex != index) {
$(this).datagrid('endEdit', index);
}
},
});
});
</script>