如何在dojo

时间:2019-01-09 06:34:32

标签: laravel-5.5 dojo.gridx

在函数的第一次调用中,我在数据网格中创建和删除一个数据, 之后,我尝试使用以下代码刷新数据网格。

如果我在复选框中单击复选框,则创建带有复选框的dojo数据网格,并创建一个删除按钮以删除。但是我可以删除该项目,但数据网格不会刷新。如果我再次加载,我已经注册了一个错误ID)

这是我的网格

require([“ dojo / store / JsonRest”],函数(JsonRest){                 myStore = new JsonRest({target:“ index /”});

            require([
                "dojox/grid/DataGrid",
                "dojo/data/ObjectStore",
                "dojo/domReady!"
            ], function (DataGrid, ObjectStore) {
                grid = new DataGrid({
                    store: dataStore = new ObjectStore({objectStore: myStore}),
                    structure: [
                        {name: "tik", field: "id", width: "20px", formatter: checkbox},
                        {name: "Option Code", field: "option_code", width: "200px"},
                        {name: "Option Name", field: "option_name", width: "200px"},
                        {name: "Status", field: "status", width: "200px"},


                    ]

                }, "target-node-id"); // make sure you have a target HTML element with this id
                grid.startup();
            });
        });

然后我创建一个函数

功能复选框(项目)  {

            return '<input type="checkbox" onclick="editmytest(' + item + ')">';

}

功能editmytest(item)  {                             var myButton = new Button({                             标签:“删除”,                                     onClick:函数(){

                                console.log(dom.byId('inoptioncode').value);
                                        console.log(dom.byId('inoptionname').value);
                                        console.log(dom.byId('instatus').value);
                                        //Getting and Manipulating the Value
                                        request.post("/destroy/" + item, {

                                        data: {
                                        // text field value -Getting and Manipulating the Value
                                        "_token": "{{ csrf_token() }}",
                                                id: dom.byId('inid').value,

//
                                            })。then(function(){

                                        require(["dojo/dom-construct"], function (domConstruct) {
                                        // Destroy a node byId:
                                        domConstruct.destroy("target-node-id");
                                        });

                                        }).then(function () {
                                        console.log("i destroy the previous grid and load same grid");
                                                require(["dojo/store/JsonRest"], function (JsonRest) {
                                                dataStore = new JsonRest({target: "/index"});
                                                });
                                                require([
                                                        "dojox/grid/DataGrid",
                                                        "dojo/data/ObjectStore",
                                                        "dojo/domReady!"
                                                ], function (DataGrid, ObjectStore) {
                                                grid = new DataGrid({
                                                store: dataStore = new ObjectStore({objectStore: myStore}),
                                                        structure: [
                                                        {name: "tik", field: "id", width: "20px", formatter: checkbox},
                                                        {name: "Option Code", field: "option_code", width: "200px"},
                                                        {name: "Option Name", field: "option_name", width: "200px"},
                                                        {name: "Status", field: "status", width: "200px"}
                                                        ]
                                                }, "target-node-id"); // make sure you have a target HTML element with this id
                                                        grid.startup();
                                                });
                                        });
                                        }
                                    }, "deleteprogButton").startup();
                        });

}

我以前的网格div已删除,但不再加载。

如何再次加载网格以供重用

0 个答案:

没有答案