Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
175
Rest create with batch doesn't work
posted

Hi,

Rest Api call for create new row works fine without batch statement but when I add batch Post data is null.

Like below, Item value is null when batch is true.  Any sample how does it work with batch updates?

thanks

      //   POST api/values
        public void Post( [FromBody] Item value)
        {
        }

 $(function () {
            var dataURL = "">localhost:53300/.../";
            $("#grid1").igGrid({
                dataSource: dataURL,
                primaryKey: "TIDnumber",
                restSettings: {
                    update: { url: dataURL },
                    remove: { url: dataURL, batch: true },
                    create: { url: dataURL, batch: true }
                },
                autoGenerateColumns: false,
                height: "350px",
                width: "800px",
                columns: [
                    { headerText: "TIDnumber", key: "TIDnumber", dataType: "number" },
                    { headerText: "Description", key: "Description", dataType: "string" },
                    { headerText: "Quantity", key: "Quantity", dataType: "string" }
                ],
                features: [
                    {
                        name: "Updating",
                        editMode: 'row',
                        columnSettings: [{
                            columnKey: 'TIDnumber',
                            readOnly: true
                        },
                        {
                            columnKey: "Description",
                            editorType: 'string',
                            validation: true,
                            editorOptions: { required: true }
                        }
                        ]
                    }
                ]
            });

  • 1080
    Offline posted

    Hello,

    Thank you for posting in our community.

    Since you are using batch updating you are posting to the server an array of objects (more information can be found here) however the [FromBody] attribute can read simple JSON string from the request body.

    Please let me know if you need any further assistance with this matter.