admin管理员组文章数量:1023187
Let's say I have this kind of simple dataSource:
var TasksSource = new kendo.data.DataSource({
transport: {
read: {
url: 'some url',
dataType: "json"
}
}
});
And I want to use it several times, but with different urls. I couldn't find anywhere how to pass this to dataSource. And I don't want to use global variable. I was trying with custom methods, like for example setUrl: function() .. etc
but eventually it didn't work
Let's say I have this kind of simple dataSource:
var TasksSource = new kendo.data.DataSource({
transport: {
read: {
url: 'some url',
dataType: "json"
}
}
});
And I want to use it several times, but with different urls. I couldn't find anywhere how to pass this to dataSource. And I don't want to use global variable. I was trying with custom methods, like for example setUrl: function() .. etc
but eventually it didn't work
- why wouldn't a function work? did you receive any errors? – Goose Commented Jan 10, 2014 at 22:05
- when I was trying to use "TaskSource.setUrl('test')" it showed "Object [object Object] has no method 'setUrl' " – mmmm Commented Jan 10, 2014 at 22:11
-
btw that method won't work as you didn't define a function in the datasource, so
setURL
wouldn't have existed. The way you have it written above instead just would execute the script inside of your function when it first defines your DataSource. – Goose Commented Jan 10, 2014 at 23:16 - but i defined it in my dataSource.. – mmmm Commented Jan 11, 2014 at 0:01
- you had a function inside of your datasource but that doesn't mean it is an extension of the datasource. – Goose Commented Jan 11, 2014 at 0:11
1 Answer
Reset to default 5Once you create the DataSource, set the url value like this:
TasksSource.transport.options.read.url = "Test";
Let's say I have this kind of simple dataSource:
var TasksSource = new kendo.data.DataSource({
transport: {
read: {
url: 'some url',
dataType: "json"
}
}
});
And I want to use it several times, but with different urls. I couldn't find anywhere how to pass this to dataSource. And I don't want to use global variable. I was trying with custom methods, like for example setUrl: function() .. etc
but eventually it didn't work
Let's say I have this kind of simple dataSource:
var TasksSource = new kendo.data.DataSource({
transport: {
read: {
url: 'some url',
dataType: "json"
}
}
});
And I want to use it several times, but with different urls. I couldn't find anywhere how to pass this to dataSource. And I don't want to use global variable. I was trying with custom methods, like for example setUrl: function() .. etc
but eventually it didn't work
- why wouldn't a function work? did you receive any errors? – Goose Commented Jan 10, 2014 at 22:05
- when I was trying to use "TaskSource.setUrl('test')" it showed "Object [object Object] has no method 'setUrl' " – mmmm Commented Jan 10, 2014 at 22:11
-
btw that method won't work as you didn't define a function in the datasource, so
setURL
wouldn't have existed. The way you have it written above instead just would execute the script inside of your function when it first defines your DataSource. – Goose Commented Jan 10, 2014 at 23:16 - but i defined it in my dataSource.. – mmmm Commented Jan 11, 2014 at 0:01
- you had a function inside of your datasource but that doesn't mean it is an extension of the datasource. – Goose Commented Jan 11, 2014 at 0:11
1 Answer
Reset to default 5Once you create the DataSource, set the url value like this:
TasksSource.transport.options.read.url = "Test";
本文标签: javascriptPassing url to read as a parameter in kendoui datasourceStack Overflow
版权声明:本文标题:javascript - Passing url to read as a parameter in kendoui datasource - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745539989a2155137.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论