jQWidgets Forums
jQuery UI Widgets › Forums › Grid › 2 dropdown column types in grid?
Tagged: jquery grid, jqwidgets, jqxgrid
This topic contains 4 replies, has 3 voices, and was last updated by Peter Stoev 12 years, 4 months ago.
-
Author
-
Hey guys – I have a grid and am trying to place a dropdown column type in each of two cells in the grid. Which ever cell I put first, it works, but the second one only shows the JSON value and not the dropdown values. Did I screw something up or is this a bug?
Here is a sample of the JSON data:
[{“municipalityId”:1,”municipalityName”:”Adamstown”,”dbAccess”:0,”mbAccess”:0},{“municipalityId”:2,”municipalityName”:”Albany Township”,”dbAccess”:0,”mbAccess”:0},{“municipalityId”:3,”municipalityName”:”Alsace Township”,”dbAccess”:0,”mbAccess”:0},{“municipalityId”:4,”municipalityName”:”Amity Gardens”,”dbAccess”:0,”mbAccess”:0},{“municipalityId”:5,”municipalityName”:”Amity Township”,”dbAccess”:0,”mbAccess”:0},{“municipalityId”:6,”municipalityName”:”Bally”,”dbAccess”:0,”mbAccess”:0}]
Here is the code for the grid:
function doGrid1(userID) {
var accesslevels = [
{ value: “0”, label: “None” },
{ value: “1”, label: “Read Only” },
{ value: “2”, label: “Full” },
{ value: “3”, label: “Admin” }
];var accesslevelsSource =
{
datatype: “array”,
datafields: [
{ name: ‘label’, type: ‘string’ },
{ name: ‘value’, type: ‘string’ }
],
localdata: accesslevels
};
var accesslevelsAdapter = new $.jqx.dataAdapter(accesslevelsSource, {
autoBind: true
});// prepare the data
var gridsource = {
datatype: “json”,
datafields: [
{ name: ‘municipalityId’ },
{ name: ‘municipalityName’ },
{ name: ‘mbAccess’, value: ‘mbAccess’, values: { source: accesslevelsAdapter.records, value: ‘value’, name: ‘label’ } },
{ name: ‘dbAccess’, value: ‘dbAccess’, values: { source: accesslevelsAdapter.records, value: ‘value’, name: ‘label’ } }
],
url: ‘@Url.Action(“GetUserPermissions”)’ + ‘?UserID=’ + userID
};var dataAdapter1 = new $.jqx.dataAdapter(gridsource, { async: false, autoBind: true, loadError: function (xhr, status, error) { alert(‘Error loading “‘ + gridsource.url + ‘” : ‘ + error); } });
var settings = {
width: 800,
source: dataAdapter1,
autoheight: true,
//columnsresize: true,
editable: true,
groupable: false,
//filterable: true,
pageable: false,
selectionmode: ‘singlerow’,
theme: ‘orion’,
sortable: false,
columns: [
{ text: ”, datafield: ‘municipalityId’, editable: false, visible: false },
{ text: ‘Municipality’, datafield: ‘municipalityName’, width: 250, editable: false },
{
text: ‘Mobile Access’, datafield: ‘mbAccess’, displayfield: ‘mbAccess’, columntype: ‘dropdownlist’, width: 200,
createeditor: function (row, value, editor) {
editor.jqxDropDownList({ source: accesslevelsAdapter, displayMember: ‘label’, valueMember: ‘value’ });
}
},
{
text: ‘Dashboard Access’, datafield: ‘dbAccess’, displayfield: ‘dbAccess’, columntype: ‘dropdownlist’, width: 200,
createeditor: function (row, value, editor) {
editor.jqxDropDownList({ source: accesslevelsAdapter, displayMember: ‘label’, valueMember: ‘value’ });
}
}
]};
$(“#jqxgrid1”).jqxGrid(settings);
}And finally, I have included a screen shot of the issue…
Hi robrichard,
We confirm the issue and we will fix it for the next version. Thank you very much for the provided feedback. Unfortunately, we cannot offer a workaround at present.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThanks Peter! Any chance I can get an advanced version with the fix in it?
Rob
Is this issue is more generally related to the ability to have multiple foreign sources attached to a single jqxgrid?
I find the same problem in trying Foreign Key and Keys /Values experiments.Will this be enabled in the April time or possibly in a release before then?
Hi markcarpe,
The issue is related to Foreign Keys/Values. It will be fixed for the next release.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.