Getting this error when escaping / in json
error message there was an error parsing/evaluating the JSON string: Unexpected token / when escaping of special characters infragistics.datasource.js:36
in database users where storing dates like this 10/07 in a text field I escaped the / so json looks like this
{"id":"64198","site_id":"263","room_id":"90","guardian_id":"29496","active":"A","child_first_name":"Jordan 10\/07","child_middle_initial":"","child_last_name":"Jackson","child_full_name":"JACKSON, JORDAN 10\/07","child_ssn":"","child_date_of_birth":"2007-10-05 00:00:00","child_approx_date_of_birth":"0","older_infant":"0","class_room":"3-4 YR B","ethnicity":"","has_breakfast":"0","has_lunch":"0","has_snack":"0","has_am_supplement":"0","has_dinner":"0","has_pm_supplement":"0","created_date":"2007-12-11 00:00:00","created_time":"120008","created_by":"GLADYS","updated_date":"2012-07-19 00:00:00","updated_time":"094504","updated_by":"GLADYS"}
using hgrid like this
$.ig.loader(function () { var jsonp = new $.ig.JSONDataSource({ dataSource: "/childcare/Sites/api_index.json", datatype: "jsonp", callback: "render", responseDataKey: "" })
$("#grid1").igHierarchicalGrid({ autoGenerateColumns: false, autoGenerateLayouts: false, caption: "Sites", expandCollapseAnimations: true, animationDuration: 1000, initialDataBindDepth: -1, dataSource: jsonp, dataSourceType: "json", responseDataKey: "", width: "98%", primaryKey: "id", columns: [...
thanks in advance
Hi there,
Could you tell us which version of the Ignite UI product you are using and also if possible, could you attach a zip file with a sample isolating the issue. This would allow us to look at it much quicker. Thanks a lot in advance!
2012.2 is installed but I am pulling from CDN attached json you will see contains / which are escaped for example 8/15 is 8\/15 thanks
$.ig.loader({ scriptPath: "http://cdn-na.infragistics.com/jquery/20122/hidden/1021/js", cssPath: "http://cdn-na.infragistics.com/jquery/20122/hidden/1021/css", resources: "igCombo,igTemplating", theme: 'metro' });
forgot attachment
Hi, Palmertj.
You will find as an attached file, a sample that I was able to modify and run using the data that you've sent. It's not exactly the same, but I didn't have enough information for igHierarchicalGrid column definitions to do it. I hope starting from there you will be able to modify it for your needs. You will also find some useful comments in the code itslef. In addition to that, below I describe some configurations you must be aware of.
First of all please use the latest version of the CDN files, which you can find here http://cdn-na.infragistics.com/. I see that you are uisng different.
When using the Infragistics loader for a certain control, you can use the following statement: resources: "igHierarchicalGrid.*". Now you can be sure that all the necessary resources for the igHierarchicalGrid will be loaded.
You have that sort of error because at runtime the JSONP data source you are using is empty. The JSONP data source is empty, not because of some escaping, but because you didn't define schema. Because the data you are recieveing is hierarchical one, igDataSource cannot parse it without schema. For more information about igDataSource and defining schema for the component please use the igDataSource help topics.
But you can use another approach. You can directly pass the data to the igHierarchicalGrid, without defining any schema. In the sample you will see that I use local data that I directly set to the 'dataSource' option. In your case, when you are uisng remote data, you will use the 'dataSourceUrl' option instead, and instead of dataSourceType of 'json' use 'jsonp'.
And last but not least, your 'responseDataKey' is not empty string but "Site". Note that the data array is wrapped in a obejct called "Site".
I hope you will be able to modify the sample for your needs and will wait for your feedback or any other questions.
Best regards, Nikolay Alipiev
in regards to cdn if I use latest it shows trial watermark I am using the one that they sent me for that incident I replaced the part of url that was specific to my licence with word "hidden" since i was told nt to share it
I didn't know about the trademark, but as far as you have a working scenario and you managed to modified it for your needs, this is great.
Best regards, Nikolay Alipiev.