So, I have a Kendo grid. On each row of the grid is a selectbox and that selectbox is populated by data from a query.
I perform an on-click action which executes logic in the database that updates both the data that populates the grid AND data that populates the selectbox(es). I then do a dataSource.read() on a parent grid, then another dataSource.read() on the actual grid I'm talking about, which all works fine, but the data in the selectbox(es) does not update.
How do I make the selectbox(es) update?
Here is the grid. The field that represents the selectbox is "orga_ky":
$("#organisationGrid").kendoGrid({
dataSource: dataSource
, filterable: false
, sortable: true
, reorderable: false
, columns: [
{ field: "orga_ky", width: "200px", values: ppa(window.organisations), title: "Organisation" }
, { field: "from_dt", format: "{0:dd/MM/yyyy}", title:"From" }
, { field: "until_dt", format: "{0:dd/MM/yyyy}", title:"Until" }
, { field: "sort_order_nb", title: "Primary", values: window.preferedValues }
, {
field: "peor_ky"
, title:"Actions"
, width: "100px"
, template: $gridWrapper.data('editable') ? kendo.template($("#actTpl").html()) : ''
, editor: $gridWrapper.data('editable') ? function(container, options) {
var template = kendo.template($("#editActTpl").html());
var result = template({});
container.html(result);
} : function() {}
, sortable: false
, filterable: false
, menu: false
, hidden: !$gridWrapper.data('editable')
}
]
, editable: $gridWrapper.data('editable') ? "inline" : "no"
, dataBound: function (e) {
if (this.dataSource.total() == 0) {
var colCount = this.thead.find('th').length;
var content = $gridWrapper.find('.grid-no-data').length ? $gridWrapper.find('.grid-no-data').html() : '<div style="text-align: center">Sorry, no data was found.</div>';
$(this.wrapper)
.find('tbody')
.append('<tr class="kendo-data-row"><td colspan="' + colCount + '" class="no-data">' + content + '</td></tr>');
}
var dataView = this.dataSource.data();
this.tbody.find('a.k-grid-custom-accept,a.k-grid-custom-reject').on('click', $.proxy(triggerValidateChange, this));
for(var i = 0; i < dataView.length; i++) {
highlightChanges(this.tbody.find("tr[data-uid=" + dataView[i].uid + "]"), dataView[i]);
highlightSoftDeleted(this.tbody.find("tr[data-uid=" + dataView[i].uid + "]"), dataView[i]);
}
}
, detailTemplate: kendo.template($gridWrapper.find('.organisation-change-details').html())
, detailInit: function(e) {
var detailRow = e.detailRow;
detailRow.find('td.k-detail-cell tr td').addClass('old-val');
detailRow.find('td.k-detail-cell').replaceWith(detailRow.find('td.k-detail-cell tr').html());
}
});
Here is the on-click action:
var processRestoreURL = crudServiceBaseUrl + '?method=restorePerson';
function restorePerson(id, row){
if (confirm('#getResource("person.detail.confirmrestore")#')) {
$.ajax({
type: 'POST',
url: processRestoreURL,
data: {
PERS_KY: id
},
success: function (data){
$("##list").data("kendoGrid").dataSource.read();
$("##organisationGrid").data("kendoGrid").dataSource.read();
},
error: function (xhr, textStatus, errorThrown){
alert("Error while restoring person"+ "\n"+ xhr + "\n"+ textStatus + "\n" + errorThrown);
}
});
}
}
Can anyone point me in the right direction?