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

DELETE button isn't working. I'm not getting any value on the server after that

0 Answers 23 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Juan
Top achievements
Rank 1
Juan asked on 27 Jul 2012, 01:59 PM
Hi all,

I've got a grid where I want to implement the DELETE action. When I click on the DELETE button it calls the url for that action, but no value is passed to that URL.
I'm using PHP for catching the DELETE action, but both $_GET and $_POST variables are empty.

This is my grid:

<script>
    $(document).ready(function(){
 
         
        var dataSource = new kendo.data.DataSource({
            transport: {
                read:  {
                    url: '<?= site_url('adwords/admin/getKeywordsDetails') ?>',
                    dataType: "json"
                },
                destroy: {
                    url: '<?= site_url('adwords/admin/deleteKeywordDetail') ?>',
                    dataType: "json",
                    Type: "POST"
                },
                parameterMap: function(options, operation) {
                    if (operation !== "read" && options.models) {
                        return {models: kendo.stringify(options.models)};
                    }
                }
            },
            pageSize: 50,
            autoSync: true,
            schema: {
                model: {
                    id: "id",
                    fields: {
                         
                        id: { editable: false, nullable: true },
                        segment: { type: "string" },
                        keyword: { type: "string" },
                        exact_monthly_search_target: { type: "number" },
                        broad_monthly_search_target: { type: "number" },
                        exact_competition: { type: "number" },
                        exact_estimated_avg_cpc: { type: "number" }
                    }
                }
            }
        });
        $("#keyword_ideas_result_grid").kendoGrid({
             
            dataSource: dataSource,
            scrollable: true,
            sortable: true,
            filterable: true,
            serverPaging: true,
            type: "json",
            editable: {
                update: false,
                destroy: true,
                confirmation: "Are you sure you want to remove this item?"
            },
            pageable: true,
            columns: [ {
                    field: "segment",
                    title: "<?= __("Segment") ?>"
                } , {
                    field: "keyword",
                    title: "<?= __("Keyword") ?>"
                } , {
                    field: "exact_monthly_search_target",
                    title: "<?= __("Local Exact") ?>"
                } , {
                    field: "broad_monthly_search_target",
                    title: "<?= __("Local Broad") ?>"
                } , {
                    field: "exact_competition",
                    title: "<?= __("Competition Exact") ?>"
                                 
                }, {
                    field: "exact_estimated_avg_cpc",
                    title: "<?= __("CPC Exact") ?>"
                                 
                },
                { command: "destroy", title: " ", width: 110 }
            ]
        });
    });
</script>

And my PHP receptor is ver simple:
// adwords/admin/deleteKeywordDetail
        var_dump($_GET);
        var_dump($_POST);

Have you got any idea why I'm getting those variables empty?
The READ method is working alright as I see the grid full of data, but the DESTROY is somehow not sending any parameter.

Thanks!

Juan

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Juan
Top achievements
Rank 1
Share this question
or