当前位置: 首页 > news >正文

如何自己设计一个网站自己怎么建网站

如何自己设计一个网站,自己怎么建网站,专业的网站开发公司,国际军事新闻联播在网上找了一些自动计算两列的方法&#xff0c;全部都是只能修改已有的数据的时候自动计算&#xff0c;而不能在添加一行数据的时候自动计算&#xff0c;自己花时间研究了一下&#xff0c;可实现类似计算报价的功能。效果如下图&#xff1a; HTML Code&#xff1a; <table i…

在网上找了一些自动计算两列的方法,全部都是只能修改已有的数据的时候自动计算,而不能在添加一行数据的时候自动计算,自己花时间研究了一下,可实现类似计算报价的功能。效果如下图:

image

HTML Code:
<table id="baojia" style="width:948px;height:auto" title="报价详细" iconCls="icon-edit" singleSelect="true" idField="itemid">   <thead>   <tr>   <th field="itemid" width="180" editor="text">设备名称</th><th field="attr1" width="80" editor="text">型号</th><th field="brand" width="100" editor="text">品牌</th><th field="amount" width="80" align="right" editor="{type:'numberbox',options:{precision:0}}">数量</th>  <th field="listprice" width="80" align="right" editor="{type:'numberbox',options:{precision:2}}">单价</th>   <th field="unitcost" width="80" align="right" editor="{type:'numberbox',options:{precision:2}}">小计</th></tr></thead><tfoot><td colspan="6">总价:</td></tfoot>
</table>
JS Code:
$(function(){var lastIndex;$('#baojia').datagrid({showFooter:true,fitColumns:true,toolbar:[{text:'添加',iconCls:'icon-add',handler:function(){$('#baojia').datagrid('endEdit', lastIndex);$('#baojia').datagrid('appendRow',{itemid:'',attr1:'',amount:'',brand:'',unitcost:'',listprice:''                      });lastIndex = $('#baojia').datagrid('getRows').length-1;$('#baojia').datagrid('selectRow', lastIndex);$('#baojia').datagrid('beginEdit', lastIndex);setEditing(lastIndex);//此句较为重要}},'-',{text:'删除',iconCls:'icon-remove',handler:function(){var row = $('#baojia').datagrid('getSelected');if (row){var index = $('#baojia').datagrid('getRowIndex', row);$('#baojia').datagrid('deleteRow', index);}}}],onBeforeLoad:function(){$(this).datagrid('rejectChanges');},onClickRow:function(rowIndex){if (lastIndex != rowIndex){$('#baojia').datagrid('endEdit', lastIndex);$('#baojia').datagrid('beginEdit', rowIndex);setEditing(rowIndex);}lastIndex = rowIndex;}})//计算报价小计function setEditing(rowIndex){var editors = $('#baojia').datagrid('getEditors', rowIndex);    var priceEditor = editors[4];var amountEditor = editors[3];    var costEditor = editors[5];    priceEditor.target.bind("change", function(){    calculate();});    amountEditor.target.bind("change", function(){    calculate();    });    function calculate(){    var cost = (priceEditor.target.val())*(amountEditor.target.val());console.log(cost);costEditor.target.numberbox("setValue",cost);    }    }
});

在添加按钮的handler里加入setEditing(rowIndex);可实现在新增的行里自动计算,如果没有加入这句,则需要再新增一行后,再回来点击此行编辑的时候才会自动计算。

参考资料:http://api.btboys.com/easyui/

转载于:https://www.cnblogs.com/yoomin/p/3491202.html

http://www.lbrq.cn/news/2360557.html

相关文章:

  • 昆明网站运营公司有哪些宁波抖音seo搜索优化软件
  • 抓取网站访客qq号码产品运营方案
  • 高校校园网站建设html网页制作软件
  • 如何自己建站网站制作小说网站排名前十
  • 宿迁房产网丫丫找房seo综合查询站长工具怎么用
  • 做情网站快速优化系统
  • 网页设计怎么创建站点网站seo优化
  • 烟台软件优化网站建设长春网站优化咨询
  • 网站开发一般要多少钱外链代发平台
  • web网站是什么意思做网站用什么软件好
  • 新媒体营销岗位有哪些seozou是什么意思
  • 自己做的网站被篡改怎么办聊城网站开发
  • 网站建设销售求职搜索引擎优化技术
  • 入门 做网站 书籍百度热门排行榜
  • 设计政府类网站应注意什么深圳百度竞价托管公司
  • 广东建设工程注册中心网站营销型网站制作
  • php怎么建立网站网络推广公司
  • 江西网站做的好的企业深圳关键词优化公司哪家好
  • 性价比高的vps短视频seo营销
  • 爆推联盟官网岳阳seo公司
  • 网站建设在哪个软件下做营销工具有哪些
  • wordpress控制列表页北京快速优化排名
  • 推广网站建设语句中文搜索引擎有哪些平台
  • 品牌网站建设解决方案短视频营销方式有哪些
  • 做网站可以申请个体户么三门峡网站seo
  • 天津建设银行公积金缴费官方网站独立站seo是什么
  • 建材做哪些网站好网站推广的100种方法
  • 做网站解析要多久今日重大新闻头条
  • 无锡做网站企业整站关键词快速排名
  • 怎么查网站在哪备案手游代理加盟哪个平台最强大
  • 使用YOLOv11实现水果类别检测:从数据到模型训练的全过程
  • 信而泰×DeepSeek:AI推理引擎驱动网络智能诊断迈向 “自愈”时代
  • 读取ubuntu的磁盘分区表与超级块
  • 同济医院R语言训练营第三期开讲!上交大张维拓老师主讲
  • [Nagios Core] 通知系统 | 事件代理 | NEB模块,事件,回调
  • C++类模版与友元