Hi all
I have a problem after upgrading kendo UI from 2013.2.918 to 2013.3.1316. I have a grid where I pass additional data with a separate javascript function. In the old version the data was correctly submitted in the POST but in the new version this data isn't appended anymore.
Please see the example below (look for the javascript-method "getShowDeleted"):
The element $("#ShowDeleted") is a checkbox on the same page.
As this was working in the previous version, I wonder if this is a known issue and if there is a workaround until the (potential) bug is fixed?
Greetings,
Daniel
I have a problem after upgrading kendo UI from 2013.2.918 to 2013.3.1316. I have a grid where I pass additional data with a separate javascript function. In the old version the data was correctly submitted in the POST but in the new version this data isn't appended anymore.
Please see the example below (look for the javascript-method "getShowDeleted"):
<
script
type
=
"text/javascript"
>
$(document).ready(
function () {
$("#ShowDeleted").click(function () {
var grid = $('#grid').data('kendoGrid');
grid.dataSource.read();
grid.refresh();
});
}
);
function getShowDeleted() {
var showDeleted = { "showDeleted": $("#ShowDeleted").is(':checked') };
return showDeleted;
}
/* when all data is loaded into the grid,
* we are able to select either a predefined entry or
* the first one
*/
function dataBound(e) {
var selectedId = '@(this.Model.SelectedId)';
var dataItem, row;
var el = $("#grid");
var grid = el.data("kendoGrid");
$(".deleted").parent('td').parent('tr').addClass("deleted-row");
if (selectedId > 0) {
dataItem = grid.dataSource.get(selectedId);
if (dataItem) {
row = el.find("tbody>tr[data-uid=" + dataItem.uid + "]");
grid.select(row);
}
} else {
row = el.find("tbody>tr:first");
grid.select(row);
}
@if (Model.Operation != OperationType.Read)
{
<
text
>
$("#grid table").removeClass("k-selectable");
</
text
>
}
}
/* we have to do this script on THIS page,
* as the snippet relies on this.select() method
*/
function gridChange(e) {
var data = this.dataItem(this.select());
if (!data) {
return;
}
var propId = data.Id;
var url = kendo.format('@(Server.UrlDecode(Url.Action("DetailsRead", "Address", new { id = "{0}", showDeleted = "{1}" })))',
propId, $("#ShowDeleted").is(':checked'));
$.ajax({
type: 'GET',
url: url,
success: function (response) {
// Update the content div
$('#details').html(response);
}
});
}
</
script
>
@(Html.Kendo().Grid<
AddressViewModel
>()
.Name("grid")
.Events(evt =>
{
// enable grid changing only when in read-mode
if (Model.Operation == OperationType.Read)
{
evt.Change("gridChange");
}
evt.DataBound("dataBound");
})
.DataSource(datasource =>
datasource.Ajax().Read(builder =>
{
builder.Action("Read", "Address", new { id = Model.PersonId });
builder.Data("getShowDeleted");
}).Model(m => m.Id(id => id.Id)))
.Columns(columns =>
{
columns.Bound(result => result.IsDeleted).Hidden().ClientTemplate(
"<
span
class=" +
"# if (IsDeleted) { #" +
"'deleted'" +
"# } else { #" +
"'not-deleted'" +
"# } #" +
"/>");
columns.Bound(result => result.NameEstablishment);
columns.Bound(result => result.Street);
columns.Bound(result => result.Zip);
columns.Bound(result => result.Place);
})
.Pageable(pager => pager.Messages(msg =>
{
msg.Display(@Shared.PagerDisplay);
msg.Empty(@Shared.PagerEmpty);
msg.Page(@Shared.PagerPage);
msg.Of(@Shared.PagerOf);
msg.ItemsPerPage(@Shared.PagerItemsPerPage);
msg.First(@Shared.PagerFirst);
msg.Previous(@Shared.PagerPrevious);
msg.Next(@Shared.PagerNext);
msg.Last(@Shared.PagerLast);
msg.Previous(@Shared.PagerPrevious);
msg.Refresh(@Shared.PagerRefresh);
}))
.Selectable(selectable => selectable.Enabled(true))
.Sortable(x => x.SortMode(GridSortMode.SingleColumn)))
As this was working in the previous version, I wonder if this is a known issue and if there is a workaround until the (potential) bug is fixed?
Greetings,
Daniel