Newbie" scrip code in gridcontrol to set the value of a

Posted by j.kattestaart on 02-Apr-2014 01:52

I want to set the value of a checkbox column to checked when i create a row depending on a condition. However i struggle with the correct syntax. There is an example for a total value, but i tried serverla values: true, checked etc. but that doesn't seem to work. i'm trying: rbf_rbf_setGridValue2(0, 'ispaymentbyguest', rowIndex, ""); where ispaymentbyguest is the name of column. The event is oncreate in the gridcontrol ??

Posted by n.zuure on 02-Apr-2014 04:48

i think i fixed your problem.

i created a method in javascript in the page called rbf_notify(a, b) (see below)

in the oncreate of the grid i've added this:
rbf_notify(##, @@);

//function a = the gridnumber, b the gridrow

function rbf_notify(a, b) 
{ 
/*unique name of the box is based on the integration name with the gridnumber and row*/ 
var integrationname = "testbox1"; 

// creating the name. 
var name = integrationname + "_" + a + "_" + b; 

// getting all the elements with the name... (unique = 1) 

var tmp = document.getElementsByName(name); 

// setting the value to true; 
tmp[0].checked = true; 
}


@Edit

you can also use

rbf_setChecked(name, true);

instead of

var tmp = document.getElementsByName(name);

tmp[0].checked = true;



All Replies

Posted by n.zuure on 02-Apr-2014 02:44

Is this with creating an object or editing an existing one?

Does the value of the checkbox depend on the value of the object or does it depend on the value of the row?

Posted by Sharavan Kumar on 02-Apr-2014 02:54

HI ,

can u try with rbf_setChecked(fieldname, isChecked);

Posted by j.kattestaart on 02-Apr-2014 03:10

Actually i want to fill a checkbox in the grid whebn i create a new row (onCreate)

The value depends on a the situation  (i have for differente situations)

if situation 1: checkbox1 = checked, checkbox2 = unchecked

if situation 2: etc.

when i leave the events out is works, but i want to manipulate the checkboxes on create of the row.

PS shkumar the rbf_setChecked cannot be used in the gridcontrol

Posted by n.zuure on 02-Apr-2014 03:59

is the value of the checkbox depening on some value in a row of the grid?

or does it depend on a field that is defined somewhere else in the page?

Posted by n.zuure on 02-Apr-2014 04:48

i think i fixed your problem.

i created a method in javascript in the page called rbf_notify(a, b) (see below)

in the oncreate of the grid i've added this:
rbf_notify(##, @@);

//function a = the gridnumber, b the gridrow

function rbf_notify(a, b) 
{ 
/*unique name of the box is based on the integration name with the gridnumber and row*/ 
var integrationname = "testbox1"; 

// creating the name. 
var name = integrationname + "_" + a + "_" + b; 

// getting all the elements with the name... (unique = 1) 

var tmp = document.getElementsByName(name); 

// setting the value to true; 
tmp[0].checked = true; 
}


@Edit

you can also use

rbf_setChecked(name, true);

instead of

var tmp = document.getElementsByName(name);

tmp[0].checked = true;



This thread is closed