This is a migrated thread and some comments may be shown as answers.

Destroy (Delete) Command Button Stopped Firing.. Why?

1 Answer 639 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 05 Jul 2013, 02:19 PM
So here is  a copy of the current Grid code.  It was working fine - and suddenly noticed that it simply stopped firing.  FireBug doesn't show anything happening at all.

// Make Grid Appear
        generateGrid();
        
    // Function to actually build the grid
        
        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: "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


---------------

Any suggestions?

Thanks, in advance...

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 09 Jul 2013, 01:22 PM
Hello,

You should use the editable configuration to enable editing in order for the destroy command to work. Also note that autoSync is a configuration option of the dataSource and not the Grid.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Lee
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or