jQWidgets Forums
jQuery UI Widgets › Forums › Grid › jqxDropDownList in jqxGrid
Tagged: jqxDropDownList, jqxgrid
This topic contains 6 replies, has 2 voices, and was last updated by btpy 12 years, 1 month ago.
-
Author
-
Hello!
I’m having some troubles with getting values of DropDownList,
after initializing it as shown in the demo:
{
text: ‘textField’, datafield: ‘Name’, displayfield: Name’, columntype: ‘dropdownlist’,
createeditor: function (row, value, editor) {
editor.jqxDropDownList({ source: worksAdapter, displayMember: ‘label’, valueMember: ‘value’ });
}, width:600
},I’m trying to get values from grid with .jqxGrid(‘getRows’).
But I just don’t know how to deal with values of DropDownList, because i get only labelsHi btpy,
You can see this sample: gridkeyvaluescolumnwitharray.htm.
And also: gridkeyvaluecolumn.htm.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comAs for now I can only see the way out in making extra arrays and merging them or smth like that, but seems to me, that would be overkill.
Isn’t there a method to get both params from ‘getRows’?
or even only valueHi btpy,
getrows returns the Grid rows. If your row has “label” and “value” members then the jqxDropDownList will have label and value. That is because in the posted code you have specified that the displayMember is ‘label’ and valueMember is ‘value’.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI apologize if I’m understanding you wrong,
but when take this:
{
editor.jqxDropDownList({ source: worksAdapter, displayMember: ‘label’, valueMember: ‘value’ });
}, width:600
and try to change displayMember and valueMember different ways, i get the same ‘getRows’ Array. In fact – the same select output in the gridHi btpy,
Ok, what is worksAdapter? It it the same adapter that you use for the Grid? If it is the same, then it is not necessary to use “createeditor” at all, because it automatically binds the DropDownList.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comOh, no.
grid uses one adapter and List – another:var worksSource =
{
datatype: “json”,
data: {“contractId”: contractId},
datafields: [
{ name: ‘label’, type: ‘string’ },
{ name: ‘value’, type: ‘string’ }
],
url: ‘/state/works/’
};
var worksAdapter = new $.jqx.dataAdapter(worksSource, {
loadComplete: function () {
// get data records.
var records = dataAdapter.records;
}
});var source =
{
datatype: “json”,
data: {“actId”: actId, “contractId”: contractId},
datafields: [
{ name: ‘Act_Work_ID’ },
{ name: ‘Act_ID’ },
{ name: ‘Act_Work_Percent’ },
{ name: ‘Act_Work_Base_Price’ },
{ name: ‘Act_Work_Full_Price’ },
{ name: ‘Contract_Work_Name’ }
],
url: ‘/state/workstable/’};
var dataAdapter = new $.jqx.dataAdapter(source, {
loadComplete: function () {
// get data records.
var records = dataAdapter.records;}
});
// initialize jqxGrid
$(“#jqxgrid”).jqxGrid(
{
… the same code -
AuthorPosts
You must be logged in to reply to this topic.