首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JSGrid回调方法

JSGrid回调方法
EN

Stack Overflow用户
提问于 2015-08-04 18:25:15
回答 1查看 2.8K关注 0票数 0

我正在使用JSGrid (js-grid.com)构建网格。我希望回调方法在添加新记录或更新记录之前实现验证。网站上提供的文件没有明确提到如何实施。请参考http://js-grid.com/docs/#callbacks。我需要帮助如何实现回调方法,因为我对JSGrid &脚本很陌生。下面是我的示例代码。请指导我在哪里放置回调方法。

代码语言:javascript
复制
    $(function() {

    $("#jsGrid").jsGrid({
        height: "90%",
        width: "100%",

        filtering: true,
        editing: true,
        sorting: true,
        paging: true,
        autoload: true,

        pageSize: 15,
        pageButtonCount: 5,

        deleteConfirm: "Do you really want to delete the client?",

        controller: db,

        fields: [
            { name: "Name", type: "text", width: 150 },
            { name: "Age", type: "number", width: 50 },
            { name: "Address", type: "text", width: 200 },
            { name: "Country", type: "select", items: db.countries, valueField: "Id", textField: "Name" },
            { name: "Married", type: "checkbox", title: "Is Married", sorting: false },
            { type: "control" }
        ]
    });

});

谢谢你的进阶。

EN

回答 1

Stack Overflow用户

发布于 2017-02-06 07:52:45

代码语言:javascript
复制
$(function() {

$("#jsGrid").jsGrid({
    height: "90%",
    width: "100%",

//为演示添加

代码语言:javascript
复制
onItemInserting: function(args) {},  // before controller.insertItem
onItemInserted: function(args) {},   // on done of controller.insertItem
onItemUpdating: function(args) {},   // before controller.updateItem
onItemUpdated: function(args) {},    // on done of controller.updateItem
onItemDeleting: function(args) {},   // before controller.deleteItem
onItemDeleted: function(args) {},    // on done of controller.deleteItem

    filtering: true,
    editing: true,
    sorting: true,
    paging: true,
    autoload: true,

    pageSize: 15,
    pageButtonCount: 5,

    deleteConfirm: "Do you really want to delete the client?",

    controller: db,

    fields: [
        { name: "Name", type: "text", width: 150 },
        { name: "Age", type: "number", width: 50 },
        { name: "Address", type: "text", width: 200 },
        { name: "Country", type: "select", items: db.countries, valueField: "Id", textField: "Name" },
        { name: "Married", type: "checkbox", title: "Is Married", sorting: false },
        { type: "control" }
    ]
});

});

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31816577

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档