I'm using Dojo 1.5 for building a Web Application. Currently, I'm trying to make a Form to fill some data in the Database, and this form needs a ComboBox with some pre-loaded data for the user to select. What I'm trying to do is declare that combo with ItemFileWriteStore
as data source and FilteringSelect
as the Widget. The ItemFileWriteStore
goes like this:
<div dojoType="dojo.data.ItemFileWriteStore" jsId="itemsStore" url="rest/items">
</div>
The rest/items
URI return this:
{"items":[{"id":1003,"description":"And Item","name":"Items"}]}
And my Combo widget goes like this:
<input dojoType="dijit.form.FilteringSelect" name="item_edited"
store="itemsStore" searchAttr="name" id="item_edited" required="true" />
When I load the form I can see the FilteringSelect
with the data that comes from the REST Service. But when I select the only item in the Combo and make a POST request to persist the data, I'm seeing this in Firebug:
Parameters (application/x-www-form-urlencoded)
form_item 123
another_form_item foo
item_edited 1
So I expect thed attribute id
from the JSON type (that for the only item returned is 1003 ) to be sent to the Server, but I'm getting son ordinal position instead. How do I tell FilteringSelect
to use the id
attribute of the JSON returned as value?
您可以在URI返回的JSON中指定标识符属性:
{"identifier" : "id", "label" : "name", "items":[{"id":1003,"description":"And Item","name":"Items"}]}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.