{"ab_Id":"3", "pr_Nazwa":"Subiekt GT", "ab_Klucz":"fjo3r-3reft-et3fo-3rtt3-fwef2", "adr_NazwaPelna":"ABC s.c. Sklep spo\u017cywczy", "ab_DataDo":{ "date":"2012-04-04 00:00:00", "timezone_type":3, "timezone":"UTC" }, "adr_NIP":"894-56-53-563"},
I want to create a grid where the data for the grid comes from a remote datasource but then is re-packaged by a javascript function after the data arrives but before it is displayed (repackaged means some rows are dropped and only some fields are displayed). The grid needs to show a loading gif (as per usual) while waiting for the remote datasource and javascript function to complete processing. What is the right way to set this up?
This sort of thing (below) for example doesn’t work, because the processData() function completes without waiting for the remote datasource to return its data, plus the grid isn’t aware it needs to invoke its loading.gif.
var dataSource = new kendo.data.DataSource({
function
hideNavBarsOnScroll() {
var
ggPosn =
'0'
;
var
log =
''
;
var
drag =
new
kendo.Drag($(
'#endless-scrolling'
), {
start:
function
(e) {
if
(e.y) {
ggPosn = $(
'#endless-scrolling'
).offset().top;
}
},
move:
function
(e) {
if
(e.y) {
if
($(
'#endless-scrolling'
).offset().top < ggPosn) {
if
($(
'#homeview header'
).is(
':visible'
)) {
$(
'#homeview header'
).slideUp(
'slow'
);
$(
'#homeview .km-footer'
).attr(
'style'
,
'position:absolute;'
).animate({
'bottom'
:
'-'
+ $(
'#homeview .km-footer'
).height() +
'px'
},
'slow'
,
function
() { });
}
}
else
{
if
($(
'#endless-scrolling'
).offset().top > ggPosn) {
if
($(
'#homeview header'
).is(
':visible'
) ==
false
) {
$(
'#homeview header'
).slideDown(
'slow'
);
$(
'#homeview .km-footer'
).attr(
'style'
,
'position:absolute;'
).animate({
'bottom'
:
'0px'
},
'slow'
,
function
() { });
}
}
}
}
},
end:
function
(e) {
if
(e.y) {
ggPosn = $(
'#endless-scrolling'
).offset().top;
}
}
});
}
var tourt = kendo.template('<tr><td>${TotalRegistration=MemberRegistrationCount+GuestRegistrationCount}</td></tr>');
var tourh = '<table id="tourg"><thead><tr><th># Registered</th></tr></thead></table>';
tourngrid = $('#tourg').kendoGrid({ rowTemplate: tourt }).data('kendoGrid');
$('#minUsers').kendoNumericTextBox();
$('#goFilter').click(function() {
tourngrid.dataSource.filter({filter: { field:"TotalRegistration", operator:"ge", value:$('#minUsers').data('kendoNumericTextBox').value()}});
});
Amazingly the assignment in the row template still reports the correct number in the grid column. But it does not execute the filter using that assigned variable defined in the template.
Is there a way to sum two columns and use the result in the grids filter?