[原创]EasyUI的edatagrid中的行combobox级联实例代码

            //            $('#goods-grid').edatagrid({
            //                url: '/ClientGoods/Goods?client=' + client + '&' + Math.random(),
            //                saveUrl: '/ClientGoods/SaveGoods?Client_ID=' + client + '&' + Math.random(),
            //                updateUrl: '/ClientGoods/SaveGoods?Client_ID=' + client + '&' + Math.random(),
            //                destroyUrl: '/ClientGoods/Remove',
            //                onAdd: function(index, row) {
            //                    var product = $('#goods-grid').datagrid('getEditor', { index: index, field: 'Product_Name' }).target;
            //                    var name = $('#goods-grid').datagrid('getEditor', { index: index, field: 'Goods_Name' }).target;
            //                    product.combobox({
            //                        onSelect: function(value) {
            ////                            alert('/GoodsROM/Goods?product=' + value.Identifier + '&' + Math.random());
            //                            var url='/GoodsROM/Goods?product=' + value.Identifier + '&' + Math.random();

            //                            name.combobox({url:'/GoodsROM/Goods?product=' + value.Identifier + '&' + Math.random(),valueField:'Goods_ID',textField:'Goods_Name',required:true,panelHeight:'auto'});
            //                        }
            //                    });

            //                    name.combobox({
            //                        onSelect: function(value) {
            //                            //alert(value.Goods_Name);
            //                            //获取物理属性值
            //                            getGoods(value.Goods_ID, index);
            //                            //alert('end');
            //                        }
            //                    });

            //                },
            //                onEdit: function(index, row) {
            //                    var product = $('#goods-grid').datagrid('getEditor', { index: index, field: 'Product_Name' }).target;
            //                    var name = $('#goods-grid').datagrid('getEditor', { index: index, field: 'Goods_Name' }).target;
            //                    product.combobox({
            //                        onSelect: function(value) {
            //                            //alert('/GoodsROM/Goods?product=' + value.Identifier + '&' + Math.random());
            //                            var url='/GoodsROM/Goods?product=' + value.Identifier + '&' + Math.random();

            //                            name.combobox({url:'/GoodsROM/Goods?product=' + value.Identifier + '&' + Math.random(),valueField:'Goods_ID',textField:'Goods_Name',required:true,panelHeight:'auto'});
            //                        }
            //                    });
            //                    name.combobox({
            //                        onSelect: function(value) {
            //                            //alert(value.Goods_Name);
            //                            //获取物理属性值
            //                            getGoods(value.Goods_ID, index);
            //                            //alert('end');
            //                        }
            //                    });

            //                },
            //                onBeforeSave: function(index, row) {
            //                    row.Goods_ID = row.Goods_Name;
            //                    row.Client_ID = client;
            //                    row.Product_ID = row.Product_Name;
            //                }
            //            });


        });

        function getGoods(id,index) {
            $.post('/Goods/getGoods', { identifier: id }, function(data) {
                if (data) {
                    var phy = $('#goods-grid').datagrid('getEditor', { index: index, field: 'Physical' }).target;
                    var che = $('#goods-grid').datagrid('getEditor', { index: index, field: 'Chemistry' }).target;
                    $(phy).val(data.Physical);
                    $(che).val(data.Chemistry);
                }

            }, 'json');
        //         }

赞(0) 打赏
分享到: 更多 (0)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏