jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Feedback on grid documentation
Tagged: documentation grid
This topic contains 1 reply, has 2 voices, and was last updated by Peter Stoev 10 years, 10 months ago.
-
Author
-
1. For columntype “dropdownlist”, you apparently also have to specify datafield and displayfield. This is not mentioned in the doc. If you omit displayfield then closing the editor results in a js error.
2. You have to name your datafield and displayfield fields in the jqxDataAdapter source that the grid is bound to. Here are the 2 I added:
{name: “tifSource”, value: “tif” },
{name: “tif”},3. If you don’t implement the “createeditor” callback then the dropdownlist will only contain the distinct values it found in the data. So you have to re-initialize its source with the superset of possible values. Unfortunately the example posted online for jqxGrid with dropdownlist is confusing/misleading: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxknockout/gridwithdropdownlist.htm?arctic
Here’s the column definition I ended up with and it’s working.
{
text: “TIF”,
datafield: “tifSource”,
displayfield: “tif”,
editable : true,
cellclassname: “editableCell”,
filtercondition: “starts_with”,
width: 60,
hideable: false,
columntype: “dropdownlist”,
cellbeginedit: function (row, datafield, columntype) {
var actionStatus = grid.jqxGrid(‘getcellvalue’, row, “actionStatus”);
if (typeof actionStatus !== “undefined” && actionStatus !== “”) {
return false;
}
},
createeditor: function (row, cellvalue, editor) {
var tifSource = {
localdata: [{tif: “GTC”}, {tif: “DAY”}],
datatype: “array”,
async: false
};
var tifDataAdapter = new $.jqx.dataAdapter(tifSource,
{
autoBind: true,
async: false,
uniqueDataFields: [“tif”],
autoSort: true,
autoSortField: “tif”
});
editor.jqxDropDownList({
source: tifDataAdapter,
displayMember: “tif”,
valueMember: “tif”,
autoDropDownHeight: true,
openDelay: 1,
closeDelay: 1,
animationType: “none”
});
}
},At a minimum the doc should be improved, but ideally they should simplify how to set up this editor in the grid because it’s not obvious.
Hi JAlecMurphy,
1. This is not necessary. This is necessary only when you want to customize the DropDownList editor and only if you choose to set these properties.
2. This is demonstrated in the sames and in the Grid’s data sources help topic: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm.Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.