Reputation: 4266
I have this Kendo UI grid. It reads and populate the grid. But the problem I'm facing is that neither update or delete button sends a POST request.
The save button does nothing. The delete button gives me a confirmation alert box then it removes it in the grid, but no request.
<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=" " >
<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>
Upvotes: 3
Views: 5637
Reputation: 3210
Similar situation but I disabled autosync as my grid datasource is read after page load. Implemented javascript to sync on change or remove when autosync=false.
function gridChange(e) {
if (e.action == "itemchange") {
e.sender.sync();
};
if (e.action == "remove") {
e.sender.sync();
}
}
Upvotes: 2
Reputation: 4266
I solved the problem. The data source needed to have the attribute "autoSync='true'"
From kendo manual
autoSync Boolean (default: false)
Enables (true) or disables (false) the automatic invocation of the sync() method for each change made
Upvotes: 5
Reputation: 2004
So I assume your crUD Urls are not being hit. There is a method signature behind those two operations that does not match what Kendo wants. That is about all I can do with what you have posted here. Hope it helps. When you get it to work, don't forget to return the data back to the Grid on your Update or you will get funny behavior.
Upvotes: 0