Announcement
Collapse
No announcement yet.
X
-
What it is expecting is the actual javascript instantiated object, just like you would declare in SmartClient. Easiest way is look at the SmartClient examples, add a DynamicForm directly into your 'script' in your host file, then load that object i.e. isc.DynamicForm.create(...). In fact all SmartGWT widgets have a protected create() method which does this in JSNI really.
-
How to instantiate DynamicForm(JsonObject)
There is a typo in the title of this question. It should be
How to instantiate DynamicForm(JavascriptObject).
----
I would like to know how to instantiate DynamicForm(JavascriptObject).
I have a static file address.json:
My code ate that and produced a JavascriptObject jso. To verify that the json was eaten correctly, I didCode:var addressjson = { dataPath : "address", items : [ { "type" : "text", "name" : "street" }, { "type" : "text", "name" : "unit" }, { "type" : "text", "name" : "city" }, { "type" : "text", "name" : "province" }, { "type" : "text", "name" : "country" }, { "type" : "text", "name" : "zip" } ] } eatJson(addressjson);
which verified it to beCode:JSONObject json = new JSONObject(jso);
Which means jso is indeed a proper JavascriptObject.Code:{ "dataPath":"address", "items":[ {"type":"text", "name":"street"}, {"type":"text", "name":"unit"}, {"type":"text", "name":"city"}, {"type":"text", "name":"province"}, {"type":"text", "name":"country"}, {"type":"text", "name":"zip"} ] }
Then jso was fed as an argument
and on attachment to a Canvas, an exception was thrown, which says something similar toCode:form = new DynamicForm(jso);
"the object returned from JSNI is not a valid js object".
My questions are
1. Is this the right json structure as an argument for the constructor
?Code:DynamicForm(JavascriptObject)
If not, what is the right structure of the json, which when produced as a JavascriptObject, could be used as the constructor's argument.
2. Is this constructor even meant to be used for constructing the fields of a DynamicForm? If not what is it used for and what should the structure of the JavascriptObject be?Last edited by BlessedGeek; 20 Jul 2010, 15:37.Tags: None
Leave a comment: