Easyui dataGrid數據不顯示的解決辦法


最后一個項目使用了easyui datagrid,把這個封裝成控件,傳送的自定義高度,在傳送數據時發現有數據但不顯示,查詢了資料都沒有解決,最后發現高度只寫成50,增加高度后顯示正常。

調用代碼

 <grid:DataGrid runat="server" ID="crmOrders" Title="" Heards="" Height="50" />

 

控件中的代碼

function IniDataGrid(tabID) {
$('#' + tabID).datagrid({
title: '訂單',
iconCls: 'icon-edit',
//width:800,
height:  <%=Height %>,//此處變量高度
fit: false,
singleSelect: true,
//showFooter: false,
idField: 'cGoodID',
columns:[<%=ID %>columns],
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);
},
onClickCell: function (index, field, value) {
var rows = $('#<%=ID %>').datagrid('getRows');//$('#<%=ID %>').data('datagrid');//$('#<%=ID %>').datagrid('getSelected');//
//console.log('點擊行',index,'上一行',lastIndex)
if (!isEditing && field == 'iNum' && rows[index].footer == undefined) {
$(this).datagrid('beginEdit', index);
var ed = $(this).datagrid('getEditor', { index: index, field: field });
isEditing = true;
ed.target.bind('change', function () {

lastIndex = <%=ID %>GetRowIndex(ed.target);
rows[lastIndex].iNum = ed.target.val();
rows[lastIndex].iTotal = ed.target.val() * rows[lastIndex].iPrice;
rows[lastIndex].nTotalGiftNum = parseInt(ed.target.val() / rows[lastIndex].nBuyNum) * parseInt(rows[lastIndex].nGiftNum);
//console.log("開始編輯",this, index,lastIndex, rows[lastIndex]);
updataRow(lastIndex, rows[lastIndex]);
rows[rows.length - 1].iNum = 0;
rows[rows.length - 1].iTotal = 0;
rows[rows.length - 1].nTotalGiftNum = 0;
for (var i = 0; i < rows.length - 1; i++) {
//console.log("結束編輯",rows[i]);
rows[rows.length - 1].iNum = parseInt(rows[rows.length - 1].iNum) + parseInt(rows[i].iNum);
rows[rows.length - 1].iTotal = parseFloat(rows[rows.length - 1].iTotal) + parseFloat(rows[i].iTotal);
rows[rows.length - 1].nTotalGiftNum = parseInt(rows[rows.length - 1].nTotalGiftNum) + parseInt(rows[i].nTotalGiftNum);
}
updataRow(rows.length - 1, rows[rows.length - 1]);
//console.log("結束編輯",rows[rows.length-1]);
});
}
},
onEndEdit: function (index, row, changes) {
console.log("結束編輯 ", index, row, changes);
},
onClickRow: function (index, row) {
//console.log('行單擊',index,row);
}
});
}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM