Wijmo UI for the Web
columns Method
Returns a one-dimensional array of widgets bound to visible column headers.
Syntax
Javascript (Usage) 
$(function () {
    var returnsValue; // Type:  any
    returnsValue = $(".selector").wijgrid("columns");
});
Javascript (Specification) 
function columns() : any;

Return Value

A one-dimensional array of widgets bound to visible column headers.
Example
var colWidgets = $("#element").wijgrid("columns");
Remarks
wijgrid columns are represented as widgets. This method returns a one-dimensional array of widgets that are bound to visible column headers. The column widget is initiated with values taken from the corresponding item in the wijgrid.options.columns array. However, the options of a column widget instance reference not the original object but a copy created by the widget factory. Due to that, changes to the wijgrid.options.columns options are not automatically propagated to the column widget options and vice versa. To solve this issue, the wijgrid synchronized the column widget option values with the source items. This synchronization occurs inside the ensureControl() method which is automatically called at each action requiring the wijgrid to enter. Still, there is a drawback. For example, a user may want to filter wijgrid data from user code as in this sample: $("#element").wijgrid("option", "columns")[0].filterValue = "newValue"; $("#element").wijgrid("ensureControl", true); // make wijgrid re-shape data and re-render. In the sample above, nothing will happen since at synchronization user changes will be ignored.You need to change the filterValue of a column widget. This is what the columns() method is for: $("#element").wijgrid("columns")[0].options.filterValue = "newValue"; $("#element").wijgrid("ensureControl", true); // make wijgrid re-shape data and re-render. Here's the best way to change the filterValue: $("#element").wijgrid("columns")[0].option("filterValue", "newValue"); // column widget handles all the needful.
Browser Compatibility
7
5
5

See Also

Reference

wijgrid type
wijgrid jQuery Widget

 

 


© 2013 All Rights Reserved.

Send comments on this topic.