javascript - kendo-ui grid problem, I want to change the path of the URL before requesting, is there any way?
某草草
某草草 2017-06-26 10:57:03
0
1
639
var mainGridDataSource = new kendo.data.DataSource({ type: 'aspnetmvc-ajax', transport: { read: { url: "/test", contentType: "application/json", type: "POST" }, parameterMap: function (options, operation) { return JSON.stringify(options); } } });

Now when entering the page, the data of this URL is requested by default. I want to change the path of the URL after the change() event. What should I do?
I tried the following method, but it didn’t work.

mainGridOptions.dataSource.transport.read({ url: "/test2" });
某草草
某草草

reply all (1)
为情所困
function getData(opts, callback){ return new kendo.data.DataSource({ type: 'aspnetmvc-ajax', transport: { read: opts, parameterMap: function (options, operation) { typeof callback == 'function' && callback(options, operation); } } }); }

Write the request into a method, and pass the url and contentType in as attributes of an object. The business processing after the request is successful is also handled with a callback function. Just execute this method after the change event

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!