0
我有一個網格,其中一列的總數將達到此總數並顯示在頁腳上。我設法做到了與:jqgrid - 如何從用戶數據中檢索值
$response->userdata['no'] = 'Total:';
$response->userdata['amount'] = $total_amount;
當用戶想添加一個記錄,我需要檢查用戶的金額字段中輸入的值不超過100
例如,現在讓我們說網格表有2個記錄行。記錄1的金額爲30,記錄2的金額爲50.因此,總計爲80.現在,用戶現在調用添加表單並在40中鍵入要添加的金額。當提交按鈕被點擊,錯誤信息應及時和記錄不會被添加,因爲總計超過100,如果用戶需要添加40
用戶無法提交,直到總被< = 100
我的問題是,如何檢索Total值並執行檢查,以使Total不會超過100?
謝謝。
亞歷
編輯:
var table_grid = jQuery("#my_table");
table_grid.jqGrid({
url:'get.php',
datatype: 'json',
mtype: 'POST',
async: false,
colNames:['No','Amount'],
colModel:[
{name:'no',index:'no',width:50,sortable:false,editable:false,editoptions:{readonly:true,size:10}},
{name:'amount',index:'amount',align:'right',width:100,sortable:true,editable:true,formatter:'number'}
],
footerrow : true,
userDataOnFooter : true
});
你也可以發佈電網代碼嗎? – 2011-01-05 03:48:55
我已經添加了網格的代碼。我希望這就是你所指的。謝謝。 – Alex 2011-01-05 04:28:31