easyui DataGrid editors扩展之combogrid ,combogrid 下拉选择后填充 editor 列内容方法
来源:互联网 发布:360软件修补漏洞 编辑:程序博客网 时间:2024/05/19 03:23
首选是对datagrid editors 进行拓展 combogrid
jeasyui官网原文:http://www.jeasyui.com/forum/index.php?topic=478.0
Extend the 'combogrid' editor.
Code:
<pre name="code" class="javascript">$.extend($.fn.datagrid.defaults.editors, {combogrid: {init: function(container, options){var input = $('<input type="text" class="datagrid-editable-input">').appendTo(container); input.combogrid(options);return input;},destroy: function(target){$(target).combogrid('destroy');},getValue: function(target){return $(target).combogrid('getValue');},setValue: function(target, value){$(target).combogrid('setValue', value);},resize: function(target, width){$(target).combogrid('resize',width);}}});
然后是在datagrid的列中进行绑定:javascript 创建数据网格(datagrid)绑定代码如下:
$('#dg').datagrid({columns:[[{field:'productid',name:'ProductId',width:100,editor:{type:'combogrid',options:{panelWidth:450,idField:'code',textField:'name',url:'datagrid_data.json',columns:[[{field:'code',title:'Code',width:60},{field:'name',title:'Name',width:100},{field:'addr',title:'Address',width:120},{field:'col4',title:'Col41',width:100}]]}}}]]});
<table> 标记创建数据网格(datagrid)的绑定代码如下:
<table id="OtherFees" style="width:auto;height:auto"title="Editable DataGrid" iconCls="icon-edit" singleSelect="true"idField="itemid" ><thead><span style="white-space:pre"></span><tr> <th field="sheet_no" hidden="true"></th> <th field="flow_no" hidden="true"></th> <th field="itemid" align="left" width="40" >ID </th> <th field="cost_amount" hidden="true"></th> <th field="fee_name" align="left" width="160" editor="{type: 'combogrid', options: { url: '../../Ajax/Ajax_Common.ashx?action=getOtherFeelist&branch_no=<%=GetAdminBranchNo().branch_no%>', panelWidth:200, idField: 'feename', textField: 'feename', columns:[[{field:'feename',title:'费用名称',width:160},{field:'saleprice',title:'费用金额',width:60},{field:'costprice',title:'费用金额',width:60}]], onSelect: function (index, row) { var editors = $('#OtherFees').datagrid('getEditors', lastIndex_OtherFees); var Editor1,Editor2,Editor3; Editor1 = $('#OtherFees').datagrid('getEditor', { index: lastIndex_OtherFees, field: 'memo' }); Editor2 = $('#OtherFees').datagrid('getEditor', { index: lastIndex_OtherFees, field: 'fee_price' }); Editor3 = $('#OtherFees').datagrid('getEditor', { index: lastIndex_OtherFees, field: 'cost_amount' }); $(Editor2.target).numberbox('setValue',row.saleprice); $(Editor3.target).val(row.costprice); } }}">费用名称 </th> <th field="fee_price" align="left" width="60" editor="{type: 'numberbox', options: {required: true, precision: 1}}">费用金额 </th> <th field="discount" align="left" width="60" editor="{type: 'numberbox', options: {required: true, precision: 1}}">折扣 </th> <th field="real_amount" align="left" width="60" editor="{type: 'numberbox', options: {required: true, precision: 1}}" >实收 </th> <th field="repair_property" align="center" width="120" editor="{type: 'combobox', options: {required: true, precision: 1, url: '../../Ajax/Ajax_Common.ashx?action=getRepairPropertyInfo&branch_no=<%=GetAdminBranchNo().branch_no%>', valueField: 'propertyname', textField: 'propertyname' }}" >维修性质</th> <th field="memo" align="left" width="200 "editor="{type: 'text'}" >备注 </th><span style="white-space:pre"></span></tr> </thead></table>
0 0
- easyui DataGrid editors扩展之combogrid ,combogrid 下拉选择后填充 editor 列内容方法
- easyui datagrid editors扩展之combogrid
- easyui datagrid editors扩展之combogrid
- easyUI在可编辑的datagrid中加入combogrid 实现下拉选择填充列
- easyUI在可编辑的datagrid中加入combogrid 实现下拉选择填充列
- 【easyUI】下拉框中加datagrid-combogrid组件应用
- easyui的datagrid中editor和combogrid的结合使用
- easyui datagrid 编辑行绑定combogrid并实现下拉赋值
- 如何取消选择easyui-combogrid的下拉数据
- easyUI ComboGrid
- easyui ComboGrid
- jquery easyui 中combogrid , datagrid 自定义分页
- EasyUI ComboGrid(数据表格下拉框)
- easyui datagrid之editor扩展
- easyUI 中重载comboGrid的数据方法
- jQuery EasyUI使用教程之过滤ComboGrid
- easyui 过滤ComboGrid
- easyui combogrid onChanage 问题
- test
- c++参数传递
- 丁耘:开发者是打通最后一公里的决定性力量
- (Advanced Receiver Autonomous Integrity Monitoring 高级接收机自主完好性监测——词汇
- 最小长方形
- easyui DataGrid editors扩展之combogrid ,combogrid 下拉选择后填充 editor 列内容方法
- 汉诺塔
- Notification的简单使用
- xp系统Java 7环境变量配置及eclipse使用
- 用程序来控制一个网页,实现自动输入等操作
- @Override标签
- Python学习笔记___初识Python
- 小游戏------锅打灰太狼
- SlidingTabColors——viewpager和自定义导航栏