jQWidgets Forums
jQuery UI Widgets › Forums › Grid › DropDownList column with arrays only
This topic contains 4 replies, has 2 voices, and was last updated by Peter Stoev 12 years, 5 months ago.
-
Author
-
High,
just getting started with the grid in wakanda (wakanda.org) and got pretty far in short time.
However, am confused with the example for grids key/value dropdown list feature.
jq Example page:
http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/index.htm?%28classic%29#demos/jqxgrid/gridkeyvaluecolumn.htmThis lines confuse from the above examples page:
// prepare the data
var ordersSource =
{
datatype: “xml”,
datafields: [
// id – determines the id of a record in the foreign collection(employees.xml) which should match to the record’s name in the source collection(orders.xml).
// text – determines the display field from the foreign collection.
// source – determines the foreign collection.
// displayname – the field’s name in the adapter’s records array.
// name – the field’s name in the data source.
{ name: ‘EmployeeID’, displayname: ‘EmployeeName’, map: ‘m\\:properties>d\\:EmployeeID’, text: ‘EmployeeName’, id: ‘EmployeeID’, source: employeesAdapter.records },
{ name: ‘EmployeeID’, map: ‘m\\:properties>d\\:EmployeeID’ },Questions:
– do you have an example for the drop down column with arrays only (no XML, no URL, static arrays)?
– ‘EmployeeID’ column is listed 2 x above. This is confusing. Must it be 2 times?
– maps are not neccessary for arrays, correct?
– Do I need ‘source: employeesAdapter.records’ for arrays?A simple example for a drop down column would do.
Even would not need the automatic key/value feature, just want a drop down in a column.Feature request if not already existing: Visual hint in the cells with drop down list (arrow).
Thank you in advance
Alexander
Confusing in the grid example for key/values column is:
// name – the field’s name in the data source.
{ name: ‘EmployeeID’, displayname: ‘EmployeeName’, map: ‘m\\:properties>d\\:EmployeeID’, text: ‘EmployeeName’, id: ‘EmployeeID’, source: employeesAdapter.records },
{ name: ‘EmployeeID’, map: ‘m\\:properties>d\\:EmployeeID’ },In the above dataadapter, the field ‘EmployeeID’ is defined two times.
The 2nd is a subset of the first, the 2 attributes ‘name’ and ‘map’ are exactly the same.
The 1st has 2 more attributes that the 2nd field does not have.Makes no sense to me, especially because I think a datafield name should be unique in a dataadapter.
Saw this same issue in another grid topic with the hint to read the comments carefully, however does not clarify for me the reason that the field is defined 2 times with the same name.
Thanks for clarifiying this (why the field is defined 2 times and if so, why it is neccessary to have it 2 times or if the example would still work when the 2nd definition is ommitted).
Alexander
Hi fuchs4d,
1. The field is not defined 2 times. The first definition maps the EmployeeName to EmployeeID, the second definition is for an EmployeeID as we want to access the real EmployeeID, too.
2. For binding DropDownList to array, see: defaultfunctionality.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comPeter,
thank you for clarifying and the link.
(This means the “keys” for accessing datasource fields from the dataprovider are a combination of the attributes “name” and “displayname”, because “name” alone is not unique in the example).Got drop downs to work with a simple array in a grid and from there can do all I want.
To use the automatic key/value feature:
Does the automatic key/value feature also work if the data to be looked up is NOT XML based (as in the grid example), but array based?
Just for information.Alexander
Hi fuchs4d,
The jqxDataAdapter is capable to load data from Array, CSV, TSV, JSON, JSONP or XML. When it loads the data, the output is Array. So it does not matter what the data source really is.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.