This is a migrated thread and some comments may be shown as answers.

Need to customize update URL based on row being updated

3 Answers 277 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Brian Vallelunga
Top achievements
Rank 1
Brian Vallelunga asked on 22 Mar 2012, 04:52 AM
I need to be able to customize the update URL for each row in my data source. For example, the URL should be /resource/{id}. I read in another thread that it wasn't possible to set this to be a function, so I'm wondering if you could expose an event on the datasource for every row that fires during a sync. This event would pass the row so I could modify the URL on the fly.

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 23 Mar 2012, 04:27 PM
Hello Brian,

The url of the transport accepts a function since version Q1 2012. For example:
transport: {
    read: {
        url: function(options) {
            return "http://example.com/" + options.id
        }
   }
}

I hope this solves the problem.

All the best,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
TrentCioran
Top achievements
Rank 1
answered on 27 Mar 2012, 04:30 AM
this is not working for me, here my data store's transport property

            destroy: {
                url: function (options) {
                    return "MyController/Delete/" + options.id;
                }
            },

this gives me the following url 

http://localhost:24043/function%20(options)%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%20%22Taxonomy/Delete/%22%20+%20options.id;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D?Id=93210596-57ae-472a-87b0-c465e0f98170&Name=child+2&Description=child+description+2&File=null&Parent=%5Bobject+Object%5D&Attributes=null&HasApplicationErrors=false&HasErrors=false&Errors=null  

Any ideas?

Thanks!
0
Alexander Valchev
Telerik team
answered on 27 Mar 2012, 11:47 AM
Hi Manuel,

Could you please confirm that you are using the latest official release (v.2012.1.322). This is a new functionality that is not supported in the previous versions of the framework.
If that does not help, could you please post the code of your configuration or provide a sample project that I can use to reproduce the problem?

Thank you in advance.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Data Source
Asked by
Brian Vallelunga
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
TrentCioran
Top achievements
Rank 1
Share this question
or