What I want to do is take over the whole parse and stringify with a client library that handles dates better. I cannot seem to hook in the right place - before the raw data is already treated by the Kendo utils. Is this possible while using the rest of the transport functionality and if so, where do I intercept this?
10 Answers, 1 is accepted
You may use scheme parse function in order to do some preprocessing to the raw data before it is used by the data source. However, note that with Q1 2012 version of KendoUI, DataSource component will handle conversion of .NET date literals automatically, if model fields with correct type are declared, as shown in this online demo.Regards,
the Telerik team
That said, you are correct that the newer release handles the .NET serialization. I am not sure how I did not discover that but maybe I was not trying the right combo of settings. Anyway, the reads work good now. Thanks for that!
However that is only half of my issue. On the outgoing side (update/create posts), I am currently having to handle the parameterMap hook and likewise, serialize the dates into a transportable format that works in .NET JSON deserialization. And same issue, I have to property-for-property, add a harcoded line for each date field to serialize to JSON using a different client library. Thus it is not generic for all datasets and I want to avoid.
I tried just now with the latest library and settings you demonstrated, and it still fails. It fails in that it appears (by inspecting the request sent), that nothing is being JSON serialized despite having declared a JSON type for the update in the transport config. Thus on the .NET side, this URL-encoded date literal is being set to NULL since unable to rehydrate from that format.
So I guess my question is just why isn't the outgoing request serializing this data into JSON and how to change that. Any insight or help here??
So with parameterMap, I just took the data passed in, and stringified the whole object and returned that result. That works and was the final missing link. I am just a little dismayed that I didn't see this mentioned or exemplified anywhere! I was under the impression that parameterMap existed for doing additional transformations as needed (as the examples demonstrated). However, returning json data to the server, it is required that you perform this conversion, otherwise it just sends generic querystring/post parameters.
It would be nice if any of this was documented and would have saved a lot of time. Or just a one single example demonstrating a transport config, with either update or create, using both POST and JSON submission together. For such an absolute common pattern, I am amazed there isn't one example of this between the grid and datasource docs.examples.
Please confirm my assumptions in the event I am overlooking something else. Otherwise, this can be closed now.
Indeed, you should use the parameterMap to modify the send parameters in the appropriate format for the server technology you are using. You can find various examples of using paramterMap for this purpose here. Also note that almost all of the online grid editing demos are using the parameterMap to convert the changed records.Regards,
the Telerik team
In fact, most of Kendo examples have no narrative at all with many attributes set, not always relevant to the example. That is a very inefficient way to instruct, especially when in many of these cases, there are so many details that determine when to use this or that configuration and many settings are mutually exclusive. Leads to confusion and misuse.
So I guess what I am hoping is that the Kendo team can take only a little amount of time to properly document these key function and configs. And referring folks to the forum for proper docs is a very lazy approach. No disrespect, it just doesn't respect my time. That said, unfortunately, that is what I have had to do to get any real understanding, reading every single thread, looking for hidden gems of insight often not even directly related to the thread.
We do realize the importance of good documentation and examples, that is why the improvement of docs have a very high priority for us in next Q2 release.
You could read more about upcoming changes, documentation plans and new features in this blog post.
the Telerik team
To end on a better note, I do really love what you guys are doing with Kendo. I am building a product with some tough competition already in play (including one built in Flash). I had purchased $3K in components at the beginning of the year, mostly from Telerik and C1, but have loved the Kendo suite and have actually managed to keep the 3rd-party use to only Kendo's offering (and jQuery plugins of course). I have had to build some key controls that are missing from Kendo's suite but I used some existing Kendo controls as the basis for most.
So despite my criticism, I do believe in this suite and am thankful for it! I just wish I could have saved myself $2,200!!!
When might we see the better documentation please?
The current documentation is frustratingly poor, and a great obstacle to using Kendo UI in other than the most trivial ways. It is hugely time wasting to have to use a debugger to attempt to work out what is happening e.g. what the arguments passed to parameterMap() are which the doc doesn't define and so on. Or to download the full source and study the source code.
Also, I am using php in LAMP/WAMP envionments, as are many other developments, yet all non-totally trivial examples of the use of Kendo appear to be for asp net. Why? (I did notice an aspnetmvc subdirectory in the Q2 beta examples tree but not one for php or other server side language.)
In attempting to use Kendo grid for my application as a trial of Kendo I keep coming across DataSource transport issues that the doc does not address. Support is so horribly slow (72 hours for a trial user) that I will now resort to studying the full source code to try to work things out for myself. I like much of what I see about Kendo but am very disappointed in the doc, and the need for me to go to source code to try to use the system.
I do note re my previous post that the Q2 doc does include a php example. Good. (Though it does not help with my particular issues.)