queryView

returns inner element/elements of a widget that correspond to the defined parameters

object|array queryView(object|function config, [string mode] );

Parameters

configobject|functionan object with search parameters or a function with the search logic
modestringoptional, the mode of search: "all" or "parent", see details

Returns

object|arraya view object or an array of view objects in the "all" mode

Example

// searches for an element with the specified properties
var element = $$("layout").queryView({ width: 100, height: 200 });
 
// searches for a certain view in the widget
var button = $$("layout").queryView({ view:"button" });
 
// searches for all entities of the specified view
var buttons = $$("layout").queryView({ view:"button" }, "all");
 
// searches for all button elements and disables them
var btns = $$("layout").queryView({ view:"button" },"all").map(view => view.disable()); 
 
// searches for all elements the width of which is more than 100px
var elements = $$("layout").queryView(function(view){return view.config.width > 100;});

Related samples

Details

The possible modes of search are:

  • "all" - to return all corresponding elements
  • "parent" - changes the search direction, the parent element with the specified parameters is searched for
Back to top