龙空技术网

easyui中datagrid页脚数据动态刷新以及JS获取项目的绝对路径

小詹小詹 136

前言:

此时朋友们对“easyui datagrid加载数据顺序”都比较关注,兄弟们都需要知道一些“easyui datagrid加载数据顺序”的相关资讯。那么小编在网上收集了一些对于“easyui datagrid加载数据顺序””的相关知识,希望兄弟们能喜欢,我们快快来了解一下吧!

1.easyui中datagrid选择行数据时,实现在页脚对数据进行动态汇总

需要四个函数实现 onSelect onUnselect onSelectAll onUnselectAll

具体代码如下:

$('#yhxdg').datagrid({

//核销明细选择事件

onSelect:function (index,row){

var rows = $('#yhxdg').datagrid('getFooterRows');

//alert(row.HXJETZ);

var row_HXJETZ = 0;

var foot_row = rows[0];

if(row.YHXJE != ""){

row_HXJETZ = row.HXJETZ;

}

rows[0]['YHXJE'] = (parseFloat(row.YHXJE)+parseFloat(rows[0].YHXJE)).toFixed(2);//给页脚字段赋值

rows[0]['HXJE'] = (parseFloat(row.HXJE)+parseFloat(rows[0].HXJE)).toFixed(2);

rows[0]['ZHXJE'] = (parseFloat(row.ZHXJE)+parseFloat(rows[0].ZHXJE)).toFixed(2);

rows[0]['ZWHXJE'] = (parseFloat(row.ZWHXJE)+parseFloat(rows[0].ZWHXJE)).toFixed(2);

rows[0]['HXJETZ'] = (parseFloat(row_HXJETZ)+parseFloat(rows[0].HXJETZ)).toFixed(2);

//rows[0]['salary'] = 60000;

$('#yhxdg').datagrid('reloadFooter');//重新加载页脚数据

},

onUnselect:function (index,row){

var rows = $('#yhxdg').datagrid('getFooterRows');

//alert(row.HXJETZ);

var row_HXJETZ = 0;

var foot_row = rows[0];

if(row.YHXJE != ""){

row_HXJETZ = row.HXJETZ;

}

rows[0]['YHXJE'] = (parseFloat(rows[0].YHXJE) - parseFloat(row.YHXJE)).toFixed(2);

rows[0]['HXJE'] = (parseFloat(rows[0].HXJE) - parseFloat(row.HXJE)).toFixed(2);

rows[0]['ZHXJE'] = (parseFloat(rows[0].ZHXJE) - parseFloat(row.ZHXJE)).toFixed(2);

rows[0]['ZWHXJE'] = (parseFloat(rows[0].ZWHXJE) - parseFloat(row.ZWHXJE)).toFixed(2);

rows[0]['HXJETZ'] = (parseFloat(rows[0].HXJETZ) - parseFloat(row_HXJETZ)).toFixed(2);

//rows[0]['salary'] = 60000;

$('#yhxdg').datagrid('reloadFooter');

},

onSelectAll:function (rows){

var foot_YHXJE = 0;

var foot_HXJE = 0;

var foot_ZHXJE = 0;

var foot_ZWHXJE = 0;

var foot_HXJETZ = 0;

for(var i = 0;i < rows.length;i++){

foot_YHXJE = (parseFloat(foot_YHXJE) + parseFloat(rows[i].YHXJE)).toFixed(2);

foot_HXJE = (parseFloat(foot_HXJE) + parseFloat(rows[i].HXJE)).toFixed(2);

foot_ZHXJE = (parseFloat(foot_ZHXJE) + parseFloat(rows[i].ZHXJE)).toFixed(2);

foot_ZWHXJE = (parseFloat(foot_ZWHXJE) + parseFloat(rows[i].ZWHXJE)).toFixed(2);

foot_HXJETZ = (parseFloat(foot_HXJETZ) + parseFloat(rows[i].HXJETZ)).toFixed(2);

}

var foot_rows = $('#yhxdg').datagrid('getFooterRows');

foot_rows[0]['YHXJE'] = foot_YHXJE;

foot_rows[0]['HXJE'] = foot_HXJE;

foot_rows[0]['ZHXJE'] = foot_ZHXJE;

foot_rows[0]['ZWHXJE'] = foot_ZWHXJE;

foot_rows[0]['HXJETZ'] = foot_HXJETZ;

//rows[0]['salary'] = 60000;

$('#yhxdg').datagrid('reloadFooter');

},

onUnselectAll:function (rows){

var foot_rows = $('#yhxdg').datagrid('getFooterRows');

foot_rows[0]['YHXJE'] = "0";

foot_rows[0]['HXJE'] = "0";

foot_rows[0]['ZHXJE'] = "0";

foot_rows[0]['ZWHXJE'] = "0";

foot_rows[0]['HXJETZ'] = "0";

//rows[0]['salary'] = 60000;

$('#yhxdg').datagrid('reloadFooter');

}

});

})

2.JS获取路径项目绝对的判断,

function getRootPath(){

//获取当前网址,如:

var curWwwPath=window.document.location.href;

//获取主机地址之后的目录,如: uimcardprj/share/meun.jsp

var pathName=window.document.location.pathname;

var pos=curWwwPath.indexOf(pathName);

//获取主机地址,如:

var localhostPaht=curWwwPath.substring(0,pos);

//获取带"/"的项目名,如:/uimcardprj

var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);

if((localhostPaht.substring(0,16) == "") ||(localhostPaht.substring(0,17) == "")){

return(localhostPaht+projectName); //如果在本地调试,返回该值

}else{

return(localhostPaht);//部署到服务器上,返回该值

}

}

3.NC销售订单修订【修订】按钮拦截器修改

修改原因:之前未对列表界面进行判断,另外,对不是最新版本的订单进行修订,可以进入修订界面,但是在保存时,会提示当前操作单据不是最新版本,

无法进行保存。

标签: #easyui datagrid加载数据顺序 #easyui datagrid dataoptions #js绝对路径怎么写