I am having trouble with implementing key/value in the jqxgrid for displaying “enums” for a given field. I can change the field source OK, and enum ids match with field id but if I have fewer rows than enums, the dropdown list will only display a subset of the enums in the foreign source. (For instance if there are 2 rows only 2 options are listed in dropdown).
I would like all three options available even if there is a single row…
Code is below – can you tell me concept I am missing?
<script>
$(document).ready(function () {
var theme = “classic”;
/*—————————————————————————————————————————————————–*/
var dataA = [{“postype”:{“id”: “1”, “label”: “Sales” }}, {“postype”:{“id”: “2”, “label”: “Tech” }},{“postype”:{“id”: “3”, “label”: “Other” }}];
var sourceA =
{
localdata: dataA,
datatype: ‘json’,
record: ‘postype’,
id: ‘id’,
datafields: [
{ name: ‘id’, type: ‘number’, map:’postype>id’},
{ name: ‘label’, type: ‘string’,map:’postype>label’}
]
};
var dataAdapterA = new $.jqx.dataAdapter(sourceA, {autoBind: true});
/*—————————————————————————————————————————————————–*/
var dataB= [{“pos”:{“id”: “1”}}, {“pos”:{“id”: “2”}}, {“pos”:{“id”: “3”}}, {“pos”:{“id”: “2”}}];
var sourceB =
{
localdata: dataB,
datatype: “json”,
datafields: [
{ name: ‘id’, map: ‘pos>id’, values: { source: dataAdapterA.records, name: ‘label’}}
],
};
var dataAdapterB = new $.jqx.dataAdapter(sourceB);
/*—————————————————————————————————————————————————–*/ $(“#jqxgrid”).jqxGrid(
{
source: dataAdapterB,
theme: theme,
columnsresize: true,
editable: true,
selectionmode: ‘singlerow’,
editmode: ‘dblclick’,
columns: [
{text: ‘id2label’, datafield: ‘id’, columntype: ‘dropdownlist’, width: 150}