用 ext 实现 类似excel的功能 用ext 实现类似在 excel中能求和,求平均数,求总的功能。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Ext.ux.grid.GridSummary百度extjs这个插件里面有sum、avg、max、min 类似这样的?文本区域中输入1+2=,然后回车得结果 <body> <textarea rows="3" cols="20" id="calculator" style="background-color:#66FF99;"></textarea><script>var cal = document.getElementById('calculator');cal.onkeydown = function(e){ e = e || event; if(this.style.backgroundColor == '#f00')this.style.backgroundColor = '#66FF99'; if(e.keyCode == 13){ if(/^[\d,\.,\+,\-,\*,\/,\(,\)]*\=$/.test(this.value)){ this.value = eval(this.value.replace('=','')); }else{ this.style.backgroundColor = '#f00'; } return false; }}</script> </body> 差不多,但是是选中要grid那里面的单元里面的值 求选定行的和 var records = sm.getSelections();var sum = 0;for (var i = 0; i < sm.getCount(); i++) { sum=sum+records[i].get('列名');}其他同理 sm就是你的GridPanel属性,你可以在外面定义smvar sm= new Ext.grid.CheckboxSelectionModel({ singleSelect: false}); var EHGBillGrid = new Ext.grid.GridPanel({ loadMask: { msg: "请稍等,正在查询数据..." }, store: Store, margins: '1 1 1 1', region: 'center', cm: X7_Business_EHGBillcm, sm: sm, stripeRows: true, bbar: new Ext.PagingToolbar({ store: EHGBillStore, displayInfo: true, pageSize: conpageSize, emptyMsg: '没有数据可显示' }) }); 哦 我要把它写成像excel里面 用一个按钮对其进行计算,是要写在监听里面,还是写在按钮事件上??能分析一下思路不?? 可以定义cellclick事件,当触发这个事件以后可以将它的值填到你的自定义属性里,在定义一个按钮就好了. Extjs4 tree 分页 关于charAt问题,请帮忙解答! 求一正则表达 在线等!百分结.给定一个日期,怎么算出其他年份相应月份的日期 急!关于easyui中tab问题,如何添加一个新的tab 求助:用正则表达式实现“多关键字查找”及“反向比对”! href=javascript:window.open()...出现问题 请问javascript有没有判断ascii码的函数 再帮我一次。 如何从复杂json中获取对象的属性值 获取标签相对浏览器的坐标 菜鸟在此急问!!怎么样做出点击一张图片播放声音啊,急!!
Ext.ux.grid.GridSummary百度extjs这个插件
里面有sum、avg、max、min
<body>
<textarea rows="3" cols="20" id="calculator" style="background-color:#66FF99;"></textarea>
<script>
var cal = document.getElementById('calculator');
cal.onkeydown = function(e){
e = e || event;
if(this.style.backgroundColor == '#f00')this.style.backgroundColor = '#66FF99';
if(e.keyCode == 13){
if(/^[\d,\.,\+,\-,\*,\/,\(,\)]*\=$/.test(this.value)){
this.value = eval(this.value.replace('=',''));
}else{
this.style.backgroundColor = '#f00';
}
return false;
}
}
</script> </body>
var records = sm.getSelections();
var sum = 0;
for (var i = 0; i < sm.getCount(); i++) {
sum=sum+records[i].get('列名');
}
其他同理
sm就是你的GridPanel属性,你可以在外面定义sm
var sm= new Ext.grid.CheckboxSelectionModel({ singleSelect: false}); var EHGBillGrid = new Ext.grid.GridPanel({
loadMask: {
msg: "请稍等,正在查询数据..."
},
store: Store,
margins: '1 1 1 1',
region: 'center',
cm: X7_Business_EHGBillcm,
sm: sm,
stripeRows: true,
bbar: new Ext.PagingToolbar({
store: EHGBillStore,
displayInfo: true,
pageSize: conpageSize,
emptyMsg: '没有数据可显示'
})
});