Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Buttons > rowData object

rowData object

Scroll Prev Next More

 

After you inserted the button into a datagrid, you can use the rowData object to manipulate records.

 

rowData object is available in the Client Before and Client After events of the inserted button.

rowData.fields

rowData.fields is an object, where index is the name of the field, and value - a jQuery container object that contains the field.

Example 1

Make a red box around the value of the ID field:

 

rowData.fields['ID'].css('border', '1px solid red');

Example 2

Get the HTML code of the ID field

 

rowData.fields['ID'].html();

Example3

Add a prefix to the value of the ID field:

 

rowData.fields['ID'].html("some prefix" + rowData.fields['ID'].html());

rowData.keys

rowData.keys is an array of values ​​of key fields in the record.

Example

for (var i = 0; i < rowData.keys.length; i ++) {
  // Do something
}

rowData.id

rowData.id is the ID of the record. If you are running an Inline Edit, you can use the Runner.getControl function.

Example

for(var fName in rowData.fields){
  // get the control object, will work only if you open "inline"
  var ctrl = Runner.getControl(rowData.id, fName);
  if ( !ctrl ) {
    continue;
  }
   
  // get the control value
  var val = ctrl.getValue();
  if( val == "audi" )
     rowData.fields[fName].hide();
}

See also:

JavaScript API: Date Control API > getValue

Page Designer: Insert custom button

Key columns

Tri-part events

Buttons: Button object