jQWidgets Forums
jQuery UI Widgets › Forums › Lists › ListBox › Don't show the group
Tagged: dataadapter, datafields, displayMember, jqx.dataAdapter, jqxListBox, json, ListBox, valueMember
This topic contains 3 replies, has 3 voices, and was last updated by Dimitar 9 years, 11 months ago.
-
AuthorDon't show the group Posts
-
Hi,
I’m trying to binding, but I don’t show the groups, Why ?My code :
var source =
{
datatype: “json”,
datafields: [{ name: ‘IdClasificacionDetalle’, type: ‘int’ },
{ name: ‘Nombre’, type: ‘string’ },
{ name: ‘group’, type: ‘string’ }],
id: ‘IdClasificacionDetalle’,
url: ‘/Usuario/ListaClasificacionDetalle’
};
var dataAdapter = new $.jqx.dataAdapter(source, {
formatData: function (data) {
$.extend(data, {
idEmpresa: _idEmpresa
});
return data;
}
});
dataAdapter.dataBind();
// Create a jqxListBox
$(“#listboxClasificacionDetalle”).jqxListBox({
source: dataAdapter, displayMember: “Nombre”, valueMember: “IdClasificacionDetalle”, width: “100%”, height: 250, checkboxes: true
});
$(“#listboxClasificacionDetalle”).on(‘checkChange’, function (event) {
var args = event.args;
if (args) {
// index represents the item’s index.
var index = args.index;
var item = args.item;
// get item’s label and value.
var label = item.label;
var value = item.value;
alert(“label: ” + label);
}
});Hello manzam,
If you want to show data from ‘group’ datafield you should set ‘displayMember’ or ‘valueMember’ to ‘group’. You can find more information about how to Bind the ListBox to JSON data on Getting Started.
Best Regards,
NadezhdajQWidgets team
http://www.jqwidgets.com/Thanks for reply, but I need is show the Group and Name at the same time like de example “Categories”
as I do?
Hello manzam,
Setting categories (groups) when loading the listbox from JSON data is not supported. You can, however, try the approach specified in the following post as a workaround: http://www.jqwidgets.com/community/topic/combobox-list-categories/#post-49874.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.