kendo grid 的小例子

    //grid数据初始化start
            var columnsData = [{   //grid列定义start
                title: "序号",
                template: "<span class='row-number'></span>",
                width: 80
            }, {
                field: "accountCode",
                title: "科目代码",
                width: 200
            }, {
                field: "accountName",
                title: "科目名称"
            }, {
                field: "CompanyName",
                title: "目标成本"
            }, {
                field: "Country",
                title: "基线目标成本"
            }];   //grid列定义end
            $scope.templateListOption = {
                dataSource: {
                    transport: {
                        read: {
                            url: abp.appPath + 'api/services/app/DicFinancialAccount/LoadSon',
                            type: "post",
                            contentType: "application/json",
                            dataType: "json",
                            data: function () {
                                return { page: 1 };
                            }
                        },
                        parameterMap: function (options, operation) {
                            if (operation == "read") {
                                return JSON.stringify(options);
                            }
                        }
                    },
                    schema: {
                        type: "json",
                        data: function (data) {
                            return data.result.data.data; //指向返回json中的table数据项
                        },
                        model: {
                            id: "id",
                            fields: {
                                "accountCode": { editable:false, type: "number" }
                            }
                        }
                    },
                },
                editable:true,
                dataBound: function () {
                    var rows = this.items();
                    $(rows).each(function () {
                        var index = $(this).index() + 1;
                        var rowLabel = $(this).find(".row-number");
                        $(rowLabel).html(index);
                    });
                },
                columns: columnsData
            }
            //grid数据初始化end
            //基本信息input显示内容初始化数据
            $scope.projectInfo = {
                type: "8月份成本预算",
                classify: "月份成本预算",
                projectManager: "陶经理",
                projecyName: "大众",
                projectCode: "123456",
                projectLeader: "陶经理",
                startTime: "2016-06-05",
                endTime: "2016-08-15",
                price:"120000"
            };
            //测试保存数据       注意,这里可以获取grid表格里的数据,在编辑完数据之后在获取更改后的数据方法
            $scope.saveModel = function () {
                var grid = $("#grid").data("kendoGrid");//获取grid对象
                console.log(grid.dataSource.data());//获取grid里的data
            }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值