i using datagrid
instead of propertygrid
earlier , editable working fine.
now need group rows, had change datagrid
propertygrid
. when change propertygrid
editable feature of grid not working.
this code sample:
$('#wbsresourcesgrid').propertygrid({ title: 'resources', url: '/costestimation/getdataforresourcetable?wbsid=' + $('#hdnselectedid').val(), view: groupview, groupformatter: function (value, rows) { if (rows[0].wbrs_rst_type=="e") { return 'plant machinery'; } else if (rows[0].wbrs_rst_type=="s") { return 'sub contract'; } else if (rows[0].wbrs_rst_type == "m") { return 'material'; } else if (rows[0].wbrs_rst_type == "l") { return 'human resources'; } }, groupfield: 'wbrs_rst_type', fitcolumns: true, singleselect: true, idfield: 'id', method: 'post', showfooter: "true", onselect: function (index, row) { $('#wbsresourcesgrid').datagrid('showcolumn', 'tempaccid'); $('#wbsresourcesgrid').datagrid('beginedit', index); }, columns: [[ { field: 'id', title: 'id', width: 60, hidden: true }, { field: 'nameen', title: '@label.nameen', width: 180 }, { field: 'wbrs_rst_type', title: '@label.nameen', width: 180, hidden: true }, { field: 'namear', title: '@label.namear', width: 180, styler: function (value, row, index) { return { class: 'arabic' }; } }, { field: 'accno', title: '@lblcommon.accountno', width: 180, hidden: false }, { field: 'tempaccid', title: 'select acc no', width: 200, hidden: true, editor: { type: 'combogrid', options: { panelwidth: 400, textfield: 'accountno', valuefield: 'accountno', idfield: 'budgetaccountsid', required: true, url: '/costestimation/getwbsaccounts/', columns: [[ { field: 'budgetaccountsid', title: 'id', width: 150 }, { field: 'accountno', title: 'account name', width: 150 }, { field: 'accountname', title: 'account number', width: 150 }, ]], onselect: function (index, row) { accountid = row.budgetaccountsid; } } }, },// { field: 'quantity', title: '@lblwbsresources.quantity', width: 180, editor: 'text' }, { field: 'unitrate', title: '@lblwbsresources.unitrate', width: 180, editor: 'text' }, { field: 'totalcost', title: '@lblwbsresources.totalcost', width: 180, formatter: function (value, row, index) { // if (row.totalcost == "") { var rows = $('#wbsresourcesgrid').datagrid('getrows'); var total = 0; (var = 0; < rows.length; i++) { total += rows[i].quantity * rows[i].unitrate; } return total; } else { return row.quantity * row.unitrate; } } }, { field: 'predictedqty', title: 'predicted qty', width: 180, editor: 'text' }, { field: 'action', title: 'action', width: 80, align: 'center', formatter: function (value, row, index) { if (row.totalcost == "") { return ''; } if (row.editing) { if (row.id != -1) { var s = '<a href="#" onclick="saverow(this,' + index + ')">save</a> '; } else { var s = '<a href="#" onclick="addnewrow(this,' + index + ')">save</a> '; return s; } var c = '<a href="#" onclick="cancelrow(this)">cancel</a>'; return s + c; } else { if (row.id != -1) { var e = '<a href="#" onclick="editrow(this)">edit</a> '; var d = '<a href="#" onclick="deleterow(this,' + index + ')">delete</a>'; return e + d; } else { var s = '<a href="#" onclick="editrow(this)">edit</a> '; return s; } } } } ]], onbeforeedit: function (index, row) { row.editing = true; updateactions(index); }, onafteredit: function (index, row) { row.editing = false; updateactions(index); }, oncanceledit: function (index, row) { row.editing = false; updateactions(index); } }).datagrid('reloadfooter', [{ unitrate: '@lblwbsresources.totalprice', totalcost: '' }]); }
Comments
Post a Comment