Thank you in advance for any feedback:
1) Am I defining correctly the parameters to be passed on my vm.audit.load function on the grid data source?
$(document).ready(function () {
var vm = kendo.observable(fhfa.vm.default({
container: $("#app-main"),
appVersion: audit.constants.appVersion
}));
//***grid data***
var o = audit.auditCollection({});
vm.set("audit", o);
// kendo.bind($("#app-main"), vm);
$("#grid").kendoGrid({
//data: vm.audit.load,
dataSource: {
p : function(){
//*** Search criteria values ***
var auditTypeCB = $("#auditType").data("kendoComboBox");
auditTypeID: checkIfZeroOrBlank(auditTypeCB.select());
startDate: checkIfZeroOrBlank($("#sDate").val());
endDate: checkIfZeroOrBlank($("#eDate").val());
var applicationCB = $("#appDropDownList").data("kendoComboBox");
applicationID: checkIfZeroOrBlank(applicationCB.select());
auditUser: checkIfZeroOrBlank($("#user").val());
ipAddress: checkIfZeroOrBlank($("#ipAddress").val());
auditDescription: checkIfZeroOrBlank($("#description").val());
pageOffset: null;
pageSize: 0;
orderBy: null;
orderByDirection: null
},
schema: {
data: "audit.items"
},
transport: {
read: function (options) {
vm.audit.load(p.applicationID, p.auditTypeID, p.auditUser, p.ipAddress, p.startDate, p.endDate, p.auditDescription, p.pageOffset, p.pageSize, p.orderBy, p.orderByDirection, p.pageMax).then(function () {
options.success(data);
});
}
}
},
columns: [{
field: "applicationID",
hidden: true
},
{
field: "auditTypeID",
title: "Type"
},
{
field: "auditDate",
title: "Date",
},
{
field: "applicationName",
title: "Application",
},
{
field: "auditUser",
title: "User"
},
{
field: "iPAddress",
title: "IP Address"
},
{
field: "auditDescription",
title: "Description"
}],
scrollable: true,
groupable: true,
reorderable: true,
sortable: true,
selectable: true
});
audit.auditCollection = function (init) {
var o = fhfa.object.baseCollection(init);
o._name = "auditCollection"
o._createObject = function () {
return audit.audit(init);
};
o.onloading = function (args) {
vm = this;
kendo.ui.progress(vm._view.element, args.isLoading);
};
o.load = function (applicationID, auditTypeID, auditUser, ipAddress, startDate, endDate, auditDescription, pageOffset, pageSize, orderBy, orderByDirection, pageMax) {
var that = this;
var vPageSize = 100;
var vCount = 0;
var def = $.Deferred();
that._isLoading = true;
if (pageSize === 0) {
pageSize = vPageSize;
}
audit.da.auditItems_get(applicationID, auditTypeID, auditUser, ipAddress, startDate, endDate, auditDescription, pageOffset, pageSize, orderBy, orderByDirection, vPageSize, pageMax).done(function(eResult) {
var items = eResult.d.auditItems;
vCount = eReResult.d.auditItems.lenght;
that.set("total", vCount);
that.addArray(items);
def.resolve(that);
}).fail(function (error) {
if (init.onerror) init.onerror({ source: that, sourceType: that._name, error: error });
def.resolve(that);
}).always(function () {
that._isloading = false;
});
return def.promise();
};