自动秒收录

easyui是什么框架 (EasyUI 可编辑列级联操作 DataGrid)


文章编号:322 / 更新时间:2023-11-08 10:01:46 / 浏览:
DataGrid
 $(function () {
             var lastIndex;
             var $dg = $('#dg');
             $dg.datagrid({
                 width : 600,
                 height : 'auto',
                 title : '可编辑列级联操作',
                 singleSelect : true,
                 idField : 'itemid',
                 url : '/uploads/rs/233/bkf2ntm7/datagrid_data2.json',
                 columns : [[{
                             field : 'itemid',
                             title : 'Item ID',
                             width : 80
                             field : 'productid',
                             title : 'Product ID',
                             width : 120,
                             formatter : productFormatter,
                             editor : {
                                 type : 'combobox',
                                 options : {
                                     valueField : 'productid',
                                     textField : 'name',
                                    >                                     required : true,
                                     onChange : function (newValue, oldValue) {
                                 //重点在此处
                                 //先获取到当前选中行
                                 //根据当前行获取,当前行的下标
                                 //在根据下标和要获取列的filed获取对应filed的Editor对象
                                 //然后在根据对应的Editor操作
                                         var row = $dg.datagrid('getSelected');
                                         var rindex = $dg.datagrid('getRowIndex', row);
                                         var ed = $dg.datagrid('getEditor', {
                                                 index : rindex,
                                                 field : 'listprice'
                                         $(ed.target).numberbox('setValue', '2012');
                             field : 'listprice',
                             title : 'List Price',
                             width : 80,
                             align : 'right',
                             editor : {
                                 type : 'numberbox',
                                 options : {
                                     precision : 1
                             field : 'unitcost',
                             title : 'Unit Cost',
                             width : 80,
                             align : 'right',
                             editor : 'numberbox'
                             field : 'attr1',
                             title : 'Attribute',
                             width : 250,
                             editor : 'text'
                             field : 'status',
                             title : 'Status',
                             width : 60,
                             align : 'center',
                             editor : {
                                 type : 'checkbox',
                                 options : {
                                     on : 'P',
                                     off : ''
                 onBeforeLoad : function () {
                     $(this).datagrid('rejectChanges');
                 onClickRow : function (rowIndex) {
                     if (lastIndex != rowIndex) {
                         $dg.datagrid('endEdit', lastIndex);
                         $dg.datagrid('beginEdit', rowIndex);
                     lastIndex = rowIndex;
         var products = [{
                 productid : 'FI-SW-01',
                 name : 'Koi'
                 productid : 'K9-DL-01',
                 name : 'Dalmation'
                 productid : 'RP-SN-01',
                 name : 'Rattlesnake'
                 productid : 'RP-LI-02',
                 name : 'Iguana'
                 productid : 'FL-DSH-01',
                 name : 'Manx'
                 productid : 'FL-DLH-02',
                 name : 'Persian'
                 productid : 'AV-CB-01',
                 name : 'Amazon Parrot'
         function productFormatter(value) {
             for (var i = 0; i < products.length; i++) {
                 if (products[i].productid == value)
                     return products[i].name;
             return value;

相关标签: 云原生云计算开发者阿里云开源

本文地址:https://www.0558.la/article/cc7b9fef9f6793ed46e4.html

上一篇:表单数据序列怎么排序表单数据序列化后台如...
下一篇:新注册的域名多久可以备案新注册的域名要如...

温馨提示

做上本站友情链接,在您站上点击一次,即可自动收录并自动排在本站第一位!
<a href="https://www.0558.la/" target="_blank">自动秒收录</a>