Kendo UI Grids destroy and update command does not fire onclick event

I have a Kendo UI grid. He reads and fills in the grid. But the problem I'm running into is that neither the refresh button nor the delete button send a POST request.

The save button does nothing. The Delete button gives me a confirmation notification box, then it deletes it in the grid, but without asking.

     

<kendo:grid name="grid" pageable="true" groupable="false" editable="true" sortable="true" filterable="true" height="300" >
    <kendo:grid-columns>
        <kendo:grid-column title="Account" field="name"/>
        <kendo:grid-column width="250">
            <kendo:grid-column-command>
                <kendo:grid-column-commandItem name="showAccount" text="Visa konto" click="showAccount"/>
                <kendo:grid-column-commandItem name="ShowAccountSummary" text="Sammanställning" click="showAccountSummary"/>
            </kendo:grid-column-command>
        </kendo:grid-column>
        <kendo:grid-column title="&nbsp;" >
            <kendo:grid-column-command>
                <kendo:grid-column-commandItem name="save" />
                <kendo:grid-column-commandItem name="destroy" />
            </kendo:grid-column-command>
        </kendo:grid-column>
    </kendo:grid-columns>
    <kendo:dataSource pageSize="10" batch="false">
        <kendo:dataSource-schema>
            <kendo:dataSource-schema-model id="id">
                <kendo:dataSource-schema-model-fields>
                    <kendo:dataSource-schema-model-field name="id" type="number"/>
                    <kendo:dataSource-schema-model-field name="user_id" type="number"/>
                    <kendo:dataSource-schema-model-field name="name" type="string"/>
                </kendo:dataSource-schema-model-fields>
            </kendo:dataSource-schema-model>
        </kendo:dataSource-schema>
        <kendo:dataSource-transport>
            <kendo:dataSource-transport-read url="${transportReadUrl}" dataType="json" type="GET" contentType="application/json" />
            <kendo:dataSource-transport-update url="${updateAccountUrl}" dataType="json" type="POST" contentType="application/json" />
            <kendo:dataSource-transport-destroy url="${destroyUrl}" dataType="json" type="POST" contentType="application/json" />
        </kendo:dataSource-transport>
    </kendo:dataSource>
</kendo:grid>

      

+3


source to share


3 answers


I solved the problem. The data source must have the "autoSync = 'true" attribute

From the Kendo Guide



autoSync Boolean (default: false)

Enables (true) or disables (false) the automatic call to sync () for each change made

+4


source


Similar situation, but I turned off auto-sync as my network datasource is read after page load. Injected javascript to sync on change or delete when autosync = false.



function gridChange(e) {
    if (e.action == "itemchange") {
        e.sender.sync();
    };
    if (e.action == "remove") {
        e.sender.sync();
    }
}

      

+1


source


So, I am assuming your crUD addresses are not being hit. There is a method signature behind these two operations that doesn't match what Kendo wants. That's all I can do with what you've posted here. Hope it helps. When you get it working, don't forget to put the data back into the grid in your update or you will get some funny behavior.

0


source







All Articles