listSetData jQuery Plugin

Binds a list or dropdown control with object data from an array. The data can be a single value array, object array or data table (with a Rows array property). This function should be applied only to select elements.

If no data is passed the list is cleared. By default the list is cleared unless the noClear option is passed as true.

$.fn.listSetData = function(data,opt)


The following example downloads data from the server and returns a table result and binds it to a dropdown list:

function GetDeveloperList(clearList)
            function(result) {
                // Bind company and pk fields
                      <<b>>.listSetData(result,{ dataTextField: "company", dataValueField: "pk"});<</b>>

The data that is passed in in the form of a single item array, or an object array or a serialized table that has a Rows array.

If this value is null or not passed the list is cleared.

Options that allow you to specify the dataTextField and dataValueField which should reference the JavaScript object properties.

The value of the field that is the value

The display text field that is displayed in the list. If omitted the value is used for display.

By default the list is cleared before binding. Pass as true if you want to append the data.

Class Members

See also:

Class modalDialog

© West Wind Technologies, 1996-2021 • Updated: 10/09/09
Comment or report problem with topic