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

Edit popup not disappeared in jQuery Grid

1 Answer 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
n/a
Top achievements
Rank 1
n/a asked on 24 Feb 2021, 01:47 PM

Hello everybody,

I have a problem on the editing popup in the Grid widget. Based on the guide, I modified the example code in order to  to only accept READ and CREATE operations:

<script>
    $(document).ready(function () {
        var dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: '@Url.Action("GetAssignations", "Tasks")'+'/'+'@Model.IdProject',
                        dataType: "json",
                        type: 'GET'
                    },
                    create: {
                        url: '@Url.Action("CreateAssignation", "Tasks")',
                        dataType: "json",
                        type: 'POST',
                        contentType: "application/json"
                    },
                    parameterMap: function (options, operation) {
                        if (operation !== "read" && options.models) {
                            var output = "";
                            $.each(options.models, function (index, value) {
                                console.log(value);
                                output = value;
                            });
                            return kendo.stringify(output);
                        }
                    }
                },
                batch: true,
                pageSize: 20,
                schema: {
                    model: {
                        id: "idAssignation",
                        fields: {
                            idProject: { type: "number", defaultValue: function () { return @Model.IdProject} },
                            assignee: { type: "string" },
                            addedOn: { type: "date", editable: false }
                        }
                    }
                }
            });
 
        $("#grid").kendoGrid({
            dataSource: dataSource,
            pageable: true,
            //height: 550,
            toolbar: ["create"],
            columns: [
                { field: "assignee", title: "Assignee" },
                { field: "addedOn", title: "Added on" },
            ],
            editable: "popup"
        });
    });
 
</script>

 

Both READ and CREATE work because the data are correctly read/written into database; however, after the POST the editing popup does not disappear.

Could you give me some help?

Thanks in advance.

Filippo

1 Answer, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 01 Mar 2021, 01:02 PM

Hello, Filippo,
Thank you for your question.

You are indeed on the right track. However if you don't set up transport.update method of the dataSource, when updating the Grid with new data the popup will freeze as you can see in this Dojo example.

Hopefully the above helps in your scenario. Please don't hesitate to reach out should additional questions arise.

Regards,
Stoyan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
n/a
Top achievements
Rank 1
Answers by
Stoyan
Telerik team
Share this question
or