1

因此,我查看了有关此类问题的所有其他问题,但似乎找不到答案。对不起这里的长代码 - 但有人能告诉我为什么“删除”命令按钮会突然停止触发吗?它之前完美运行。如您所见,我没有附加任何代码 - 它是本机的。现在,它根本什么都不做。我在 FireBug 中看过,根本没有任何东西被解雇。

JQuery 和 Kendo 像往常一样加载 - 并且按钮正确显示。所有其他按钮工作正常。

网格截图

只是似乎看不出问题是什么......有什么建议吗?这是网格的代码:

function generateGrid() {
            $("#teamGrid").kendoGrid({
                columns: [
                    {   title: "First Name", 
                        field: "users_first_name", 
                        attributes: {
                            style: "text-align: center; font-size: 14px;"
                        },
                        filterable: true,
                        headerAttributes: {
                            style: "font-weight: bold; font-size: 14px; width: 100px;"
                        }
                    },
                    {   title: "Last Name", 
                        field: "users_last_name", 
                        attributes: {
                            style: "text-align: center; font-size: 14px;"
                        },
                        filterable: true,
                        headerAttributes: {
                            style: "font-weight: bold; font-size: 14px; width: 100px;"
                        }
                    },
                    {   title: "Email", 
                        field: "users_email", 
                        attributes: {
                            style: "text-align: center; font-size: 14px;"
                        },
                        filterable: { extra: false },
                        headerAttributes: {
                            style: "font-weight: bold; font-size: 14px; width: 300px;"
                        }
                    },
                    {   title: "User Type", 
                        field: "admin_status",
                        attributes: {
                            style: "text-align: center; font-size: 14px;"
                        },
                        filterable: true,
                        headerAttributes: {
                            style: "font-weight: bold; font-size: 14px; width: 80px;"
                        },
                        template: function(dataItem) {
                            if ( dataItem.admin_status == 0 ) {
                                return "Team Member";
                            } else if ( dataItem.admin_status == 1 ) {
                                return "Admin";
                            } else if ( dataItem.admin_status == 2 ) {
                                return "Manager";   
                            } else if ( dataItem.admin_status == 3 ) {
                                return "Acct Owner";    
                            }
                        }
                    },
                    { 
                        command: [
                            {   
                                name: "custom1", text: "Edit",
                                click: function(e) {
                                  $uid = this.dataItem(this.select()).users_id;
                                  $(".title h4").filter(":first").css({
                                     color: "blue",
                                     "text-decoration": "underline",
                                     cursor: "pointer"
                                  });
                                  var offset = $(".grid-box").offset();
                                  var newLeft = offset.left+25;
                                  newLeft = newLeft + "px";
                                  var newTop = offset.top+80;
                                  newTop = newTop + "px";

                                  // Get Profile Info
                                  $.getJSON(
                                    '/data/get_profile_data.php',
                                    { users_id: $uid })
                                    .done( function(data) {
                                        $("#users_first_name").val(data[0].users_first_name);
                                        $("#users_last_name").val(data[0].users_last_name);
                                        $("#users_email").val(data[0].users_email);
                                        $("#admin_status").val(data[0].admin_status);
                                        $("#rc").val($uid);

                                        $('#teamGrid').css("display","none");
                                          $('.grid-box2').css({
                                              display: "block",
                                              position: "absolute",
                                              top: newTop,
                                              left: newLeft,
                                           });
                                    });
                                },
                            },
                            {   
                                name: "destroy", text: "Delete"
                            }
                        ],
                        headerAttributes: {
                            style: "width: 120px;"
                        },
                        attributes: {
                            style: "text-align: center;"
                        },
                        title: " "
                    }
                    ],
                dataSource: {
                    transport: {
                        read: {
                            url: "/data/get_team.php"
                        },
                        update: {
                            url: "/data/update_teammate.php",
                            type: "POST"
                        },
                        destroy: {
                            url: "/data/delete_teammember.php",
                            type: "POST"
                        },
                        create:  {
                            url: "",
                            type: "POST"    
                        }
                    },
                    schema: {
                        data: "data",
                        total: function (result) {
                                 result = result.data || result;
                                 return result.length;
                       },
                       model: {
                            id: "users_id"   
                       }
                    },
                    type: "json" 
                },
                pageable: {
                        refresh: true,
                        pageSize: 15,
                        pageSizes: [
                            15
                        ]
                    },
                sortable: true,
                filterable: true,
                autoSync: true,
                scrollable: false,
                selectable: "row",
                reorderable: false,
                toolbar: [
                            { template: kendo.template($("#template").html()) }
                         ]

            }); // END: teamGrid

        } // END: generateGrid function

提前致谢..

4

1 回答 1

0

我不懂PHP。但是 JS 部分应该是类似的。剑道网格有吞下错误的倾向,这对开发人员来说是痛苦的找出原因。但是,为什么不在模式之后添加一个小的错误处理程序只是为了找到它是什么。我想当你遇到困难时,每一件小事都会有所帮助!

schema: {
            model: {
                id: "ID",
                fields: {
                    ID: { editable: false },
                    NumberOfLoads: { editable: true, type: "number" },
                    Hours: { editable: true, type: "number" },
                    Kilometres: { editable: false },
                    WaterUsage: { editable: true },
                    Driver: { editable: true },
                    Hole: { editable: true }
                }
            },
            errors: "Errors"
        },

        error: function (e) {
            alert(e);
        }
于 2014-01-21T14:02:15.627 回答