Client-Side Object Model - Utility Functions

xiaoxiao2021-03-06  82

Infragistics.Webui.Ultrawebgridfeedback on this topic ...

Client-Side Object Model - Utility Functions

Introduction

The utility functions described here are used by the JavaScript code of the UltraWebGrid Control. The purpose of exposing and documenting them is to allow developers to put as much logic as possible on the client machine in order to obtain gains in both performance and functionality.

Many of these Utility functions are involved with more than simply returning a property value They are concerned with 'resolving' the property value according to an ordered set of precedance rules The rules of precedance are straightforward:.. Check the local value first, if that value is 0, meaning notset, check the next most local value. This may be the Row, Column, Band or Grid. Repeat the procedure until either a value is found, or the Grid object default is encountered and applied.

HTML ID FORMATS

Many functions and properties are based on the Id of elements within the page. The Ids of elements is based upon a method of identifying Table and Cell objects uniquely as to owner and position within the Document Object Model, (DOM) of the page. The element most commonly used for funciont calls is the tag element. The Id of the tag is made up of several distinct components that are interpreted by the JavaScript in order to identify the position of the tag or cell Within the dom. The folload ID is an example of a type typical tag id representing a cell:

The components of the Id are delimited by the underscore character The first component indicates the Id of the owning grid The next component is the object type identifier:... In this case 'rc', indicating that the object is a cell If the object is a cell, the last component indicates the column number within the band that the cell belongs to. The components between the object type identifier and the last position indicate the row position of the cell within the band hierarchy. In this case the Id indicates the 4th column within the 2nd child row of the 3rd top-level row of the grid. The number of bands references by the Id is equal to the total number of components in the Id minus 2.The following Id is an example of a typical < TH> Tag id representing a column:

The first component indicates the Id of the owning grid The next component is the object type identifier:.. In this case 'c', indicating that the object is a column The next component is the index of the Band to which the column belongs. And the last component is the index of the column coven the band.

Functions

To see a description and example of the function, click on the text of the function. If you want to see all of the function definitions and examples expanded, click here. To collapse all definitions and examples, click here.

Function IGCMBO_GETCOMBOBYID (STRING Comboid)

Returns a WebCombo object based on the passed in Id value as it exists on the server. This function is useful in situations where the first parameter of a WebCombo client-side event is being used to identify which control fired the event. It is also necessary For Obtaining The Ocombo Reference from Withnin THE

InitializeCombo Event, Because The Owebcombo Variable Has Not Yet Been Assigned At That Point.var Ocombo = IGCMBO_GETCOMBOBYID ('Webcombo1');

Function IGTBL_GETELEMENTBYID (STRING TAGID)

Returns a DOM (Document Object Model) Element object based on its tag Id in a browser independant way. In order to return a valid DOM element, the Id parameter must exist within the current document as the Id attribute of an HTML element.

Var elem = igtbl_getlementbyid ('myelemid'); elem.style.backgroundcolor = "red";

Function IGTBL_GETGRIDBYID (STRING GRIDID)

Returns a Grid object based on its tag Id. The Grid object returned is a JavaScript object that contains many of the properties of UltraWebGrid as it exists within the HTML page. The Id of the Grid object is the name of the Grid on the Server. See Grid Object.

Var Grid = igtbl_getgridbyid ('UltraWebGrid1'); grid.allowupdate = false;

Function IGTBL_GETBANDBYID (String Cellid)

Returns a Band object based on the tag Id of a Cell within the grid. The function returns the Band object to which the Cell belongs. The Cell Id is the Id tag of the element representing a Grid Cell within the HTML page. ..................................

VAR BAND = IGTBL_GETBANDBYID ('UltraWebGrid1_2_3_1_4');

Function igtbl_getcolumnbyid (String Cellid)

Returns a Column object based on the tag Id of a Cell within the grid. The function returns the Column object to which the Cell belongs. The CellId parameter is the Id tag of the element representing a Grid Cell within the HTML page. The column object returned is a JavaScript object that contains the properties of the column object as it exists within the HTML page See column Object.var column = igtbl_getColumnById ( 'UltraWebGrid1_2_3_1_4').;

Function IGTBL_GETROWBYID (STRING CELLID)

Returns a Row object based on the tag Id of a Cell within the grid. The function returns the Row object to which the Cell belongs. The CellId parameter is the Id tag of the element representing a Grid Cell within the HTML page. ............. .י.

Var rot = igtbl_getrowbyid ('UltraWeBGrid1_2_3_1_4');

Function igtbl_getcellbyid (String Cellid)

Returns a Cell object based on the tag Id of a Cell within the grid. The function returns the Cell object corresponding to the CellId parameter. The CellId parameter is the Id tag of the element representing a Grid Cell within the HTML page. The Cell Object Returned IS A JavaScript Object That Contains The Properties of The Cell Object As It Exists With The HTML Page. This Utility Function Differs from the Function

IGTBL_GETELEMENTBYID IN That It Returns A New Object That Exposes Special Properties of a Grid Cell As Opposed to The HTML DOM OBJECT THAT THE HTML PAG WITHIN THE HTML Page. See Cell Object.

VAR cell = igtbl_getcellbyid ('UltraWebGrid1_2_3_1_4');

Function IGTBL_GETACTIVECECELL (String GridName) Returns a Cell Object Representing The Active Cell within the grid.

VAR Cell = igtbl_getactivecell ('UltraWebGrid');

Function IGTBL_GETACTIVEROW (String GridName)

Returns a row object representing the Active Row with the Grid

Var row = igtbl_getactiveRow ('UltraWebGrid');

Function IGTBL_ISCELL (String ItemName)

Returns a Boolean Value That Indicates if The item Denotes a Cell with the Grid

VAR BCELL = IGTBL_ISCELL ('UltraWeBGrid1RC_1_3');

Function IgTBL_ISROWLABEL (String ItemName)

Returns a Boolean Value That INDICES IF The Item Denotes a Row forin The Grid

Var browlabel = igtbl_ismrowlabel ('UltraWeBGRID1L_1_3');

Function IGTBL_ISCOLUMNHEADER (String ItemName)

Returns a Boolean Value That INDICES IF The Item Denotes a Column Withnin The Grid

VAR bcolheader = igtbl_iscolumnhead ('UltraWebGrid1c_1_3');

Function IGTBL_GETCOLLLAPSEIMAGE (String GridName, Int Bandno)

Returns the resolved collapseimage string for a band. If the value for the band is null, The function returns the grid default.

Var image = igtbl_getcollapseImage ('UltraWebGrid1', 0);

Function IGTBL_GETEXPANDIMAGE (String GridName, Int Bandno)

Returns the resolved expandimage string for a band. If The value for the band is null, The function returns the grid default. 0000-00-00 0000-00-00.

Var image = igtbl_getexpandimage ('UltraWebGrid1', 0);

Function IGTBL_GETCELLCLICKACTION (String GridName, Int Bandno)

Returns the resolved cellclickaction value for a band. If The value for the band is 0, The function returns the grid default. 0000-00-00 0000-00-00.

VAR ClickAction = IGTBL_GETCELLCLICKACTION ('UltraWebGrid1', 0);

Function IGTBL_GETSELECTTYPECTTYPECTTYPECTTYPECTTYPECTTYPECECECECECECECECECECELL (Int Bandno) Returns The Resolved SELECTTYCECECECECECELL VALUE for A Band. IF The value for the band is 0, The function returns the grid default.

Var selecttype = igtbl_getselecttypecell ('UltraWebGrid1', 0);

Function IGTBL_GETSELECTTYPECOLUMN (String GridName, Int Bandno)

Returns the resolved selecttypecolumn value for a band. If The value for the band is 0, The function returns the grid default.

Var selecttype = igtbl_selecttypecolumn ('UltraWebGrid1', 0);

Function IGTBL_GETSELECTTYPEROW (String GridName, Int Bandno)

Returns the resolved selecttyperow value for a band. If the value for the band is 0, The function returns the grid default.

VAR SELECTTYPE = IGTBL_GETSELECTTYPEROW ('UltraWebGrid1', 0);

Function igtbl_getheaderclickaction (String GridName, Int Bandno, INT Columnno)

Returns The Resolved HeaderClickaction Value for a Column. If The value for the color. If the value for the band is null, The function returns the grid default. 0000-00-00 0000-00-00..s.

VAR ClickAction = IGTBL_GetHeaderClickAction ('UltraWebGrid1', 0, 2);

Function igtbl_getallowupdate (String GridName, Int Bandno, Int Columnno)

Returns The Resolved AllowUpdate Value for a Column. If the value for the color. If The value for the band...................

Var update = igtbl_getallowupdate ('UltraWebGrid1', 0, 3);

Function IgTBL_GETALLOWCOLSIZING (String GridName, Int Bandno, INT Columnno)

Returns the resolved AllowColSizing value for a column. If the value for the Column is 0, the function checks the Band. If the value for the Band is null, the function returns the Grid default.var sizing = igtbl_getAllowColSizing ( 'UltraWebGrid1', 0 , 2);

Function IGTBL_GETROWSIZING (String GridName, Int Bandno, String Row)

Returns the resolved allow. If the value for the bas 0, the function checks the Band. The value for the band is null, The function returns the grid default.

VAR SIZING = IGTBL_GETROWSIZING ('UltraWebGrid1', 0, 'UltraWebGrid1R_3');

Function IGTBL_GETROWSELECTORS (String GridName, Int Bandno)

Returns the resolved rowselectors value for a band. If the value for the band is null, The function returns the grid default.

1 = YES

2 = NO

Var selectors = igtbl_getrowselectors ('UltraWebGrid1', 0);

Function IGTBL_GETNULLTEXT (String GridName, Int Bandno, Int Columnno)

Returns The Resolved NullText Value for a Cell. If Both The Column and Band Arex, The Function Returns The Grid Default.

Var image = igtbl_getnulltext ('UltraWebGrid1', 0, 5);

Function IGTBL_GETEDITCETCELLCLASS (String GridName, Int Bandno)

Returns The Resolved Style Class Name for Editing The Cells of A Band. If The Band Property Is Null, The Function Returns The Grid Default.

Var class = igtbl_geteditcellclass ('UltraWebGrid1', 0);

Function igtbl_getfooterclass (String GridName, Int Bandno, Int Columnno)

Returns The Resolved Style Class Name for Displaying The Footer of a Column. If The Column and Band Values ​​Are Null, The Function Returns The Grid Default.

VAR Class = IGTBL_GETFOTERCLASS ('UltrawebGrid1', 0, 4);

function igtbl_getGroupByRowClass (string gridName, int bandNo) Returns the resolved style class name for displaying grouped rows of a band. If the Band property is null, the function returns the Grid default.

Var class = igtbl_getgroupByrowClass ('UltraWebGrid1', 0);

Function IGTBL_GETHEADCLASS (String Gridname, Int Bandno, Int Columnno)

Returns The Resolved Style Class Name for Displaying The Header of a Column. If The Column and Band Values ​​Are Null, The Function Returns The Grid Default.

Var class = igtbl_gethetclass ('UltraWebGrid1', 0);

Function IGTBL_GETROWLABELCLASS (String GridName, Int Bandno)

Returns The Resolved Style Class Name for Displaying Row Labels of A Band. If The Band Property Is Null, The Function Returns The Grid Default.

Var class = igtbl_getrowlabelclass ('UltraWebGrid1', 0);

Function IGTBL_GETSELGROUPBYROWCLASS (String GridName, Int Bandno)

Returns The Resolved Style Class Name for SELECTED GROUPED ROWS OF A Band. IF The Band Property Is Null, The Function Returns The Grid Default.

Var class = igtbl_getselgroupbyrowclass ('UltraWebGrid1', 0);

Function IGTBL_GETSELHEADCLASS (String GridName, Int Bandno, Int Columnno)

Returns The Resolved Style Class Name for Displaying The Selected Column Headers. If The Column and Band Values ​​Are Null, The Function Returns The Grid Default.

Var class = igtbl_getselheadclass ('UltraWebGrid1', 0);

Function IGTBL_GETSELCELLCLASS (String GridName, Int Bandno, Int Columnno)

Returns the resolved style class name for displaying the selected cells. If The column and band values ​​are null, The function returns the grid default.

Var class = igtbl_getselcellclass ('UltraWebGrid1', 0);

function igtbl_getExpAreaClass (string gridName, int bandNo) Returns the resolved style class name for displaying the row expansion area of ​​a band. If the Band property is null, the function returns the Grid default.

Var class = igtbl_getexpareAclass ('UltraWebGrid1', 0);

Function IGTBL_TOGGLEROW (String GridName, String Srcrow, Boolean Expand)

Toggles The Expanded State of a Row Between Expanded and Collapsed.

GN - the grid name

Srcrow - The id of the row to be toggled

Expand - if true, the rows is expanded. if false, the row is collapsed

IGTBL_TOGGLEROW ('UltraWebGrid1', 'UltraWebGrid1R_1_2', true);

Function IgTBL_CLEARSELECTIONALL (String GridName)

Clears The Selection State of The Grid So That No Cells, Columns or Rows Are Selected.

Gn - the grid name.

IGTBL_CLEARSELECTIONALL ('UltraWebGrid1');

Function IGTBL_SELECTCELL (String GridName, String Cellid, Boolean Selflag, Boolean FireEvent)

Turns Selection On or Off for the specified cell.

GN - the grid name

Cellid - The ID of the Cell

Selflag - IF true, The Cell is SELECTED. IF FALSE, THE CELL IS unselected

FireEvent - IF true, An Event is Fired to Listener.

IGTBL_SELECTCELL ('gltrawebgrid1', 'UltraWebGrid1_1_2_3', true, false);

Function IGTBL_SELECTROW (String GridName, String Rowid, Boolean Selflag, Boolean FireEvent)

Turns Selection On or Off for the specified row.

GN - the grid name

Rowid - the id of the row

Selflag - IF true, The Row Is SELECTED. IF FALSE, THE ROW IS unselected

FireEvent - IF true, An Event is Fired to Listener.

IGTBL_SELECTROW ('UltraWebGrid1', 'UltraWebGrid1R_1_2', true, false);

Function IGTBL_SELECTCOLUMN (String GridName, String Columnid, Boolean Selflag, Boolean FireEvent) Turns Selection On OR Off For the Specified Column.

GN - the grid name

Columnid - The id of the column

SELFLAG - IF TRUE, The Column Is Selected. IF False, The Column IS Unselected

FireEvent - IF true, An Event is Fired to Listener.

IGTBL_SELECTCOLUMN ('UltraWebGrid1', 'UltraWebGrid1c_1_2', true, false);

Function IgTBL_SetAntactivecell (String GridName, Element Cell)

Makes The Specified Cell Element The Active Cell in The Grid. This Cell Will Have A Border Rectangle Drawn Around ITS Perime.

GN - the grid name

Cell - The Cell Element

Var cell = igtbl_getactivecell (); cell = cell.nextsibling; if (cell! = null) igtbl_setactivecell ('UltraWebGrid1', Cell);

Function IGTBL_SETATIAVEROW (String GridName, Element Row)

Makes The Specified Row Element The Active Row In The Grid. This Row Will Have A Border Rectangle Drawn Around ITS Perimeter.

GN - the grid name

Row - The Row Element

Var row = igtbl_getactiveRow (); row = row.nextsibling; if (row! = null) igtbl_setactiveRow ('UltraWebGrid1', ROW);

Function IGTBL_GETINNNNERTEXT (SourceElement)

Returns the innertext value of an HTML Element in A Browser-Independant Way.

VAR innertext = IGTBL_GETINNNERTEXT (IGTBL_GETELEMENTBYID ('UltraweGrid1_1_3_4_1'); var innertext = igtbl_getinnertext ('UltraWebGrid1_1_1');

Function igtbl_setinnertext (SourceElement, StRText)

Sets the innertext value of an HTML Element in a Browser Independant Way.

IGTBL_SETINNERTEXT (IGTBL_GETELEMENTBYID ('UltraweGrid1_1_3_4_1'), 'Cell Value'); IGTBL_SETINNERTEXT ('UltraWebGrid1_1_2', "NewValue");

Function IGTBL_SCROLLTOVIEW (GN, Child) Scrolls a Child Object of the Grid (Row or Cell) INTO View.

GN - the grid name

Child - The Dom Object You Want to Place Into View. The

Child Parameter Has to Be a child of the grid.

Var row = igtbl_getlementByid (RowID); IGTBL_ScrollToview (GN, ROW);