or
I have a grid I'd like to populate that uses a viewmodel that has a datasource with a REST url that has parameters for filtering the data. I'm trying to set the url parameters, but I'm unable to get at them from the nested datasource.
How can I make the nestd url dynamically reflect the changes in the parent observable? My viewmodel is below, and any help is appreciated!
Thanks, Dennis
var viewModel = kendo.observable({ artistFilter: "", titleFilter: "", genderFilter: "", baseUrl: 'http://www.websitecom/api/MemberSongs?format=json&memberid=@ViewBag.ProfileID', artistFilterUrl: function () { if (this.get("artistFilter") == "") { return ""; } return "&artist=" + this.get("artistFilter"); }, titleFilterUrl: function () { if (this.get("titleFilter") == "") { return ""; } return "&title=" + this.get("titleFilter"); }, Url: function () { return this.get("baseUrl") + this.artistFilterUrl() + this.titleFilterUrl(); }, gridSource: new kendo.data.DataSource({ transport: { read: { url: function () { return viewModel.Url() }, // this is where I'm having trouble dataType: "jsonp", async: false } }, schema: { data: "songs", total: "count", model: { fields: { Artist: { type: "string" }, Title: { type: "string" }, Category: { type: "string" }, Gender: { type: "string" }, CatalogNumber: { type: "string" } } } }, page: 1, pageSize: 50, serverPaging: true, serverFiltering: true, serverSorting: true })});