3.0 beta 2

How to access HTML button once created?


I know how to add a button at the top of the grid with following code (found in the documentation):

var button = new Active.HTML.BUTTON;
button.setContent("html", "Delete");
button.setEvent("onclick", DeleteRow);

But I don't know how to modify this button when an action is fired on the grid. For example, I would like to modify the button's style when the user clicks a cell.

Thanks for your help !
March 25,
Set your button as a global variable, you can then call it from anywhere in your program.
March 25,
var button = new Active.HTML.BUTTON;

function modifyStyle(event){
button.setStyle("border", "1px solid red");

function modifyContent(event){
button.setContent("html", "Modified");

var obj = new Active.Controls.Grid;
obj.setEvent("onclick", modifyStyle);

functions setStyle, setClass and setAttribute apply changes immediately. function setContent requires calling refresh() to repaint the object content.

see also:
/documentation/tutorial/html/styles.htm /documentation/tutorial/html/attributes.htm

Alex (ActiveWidgets)
March 25,
One little thing about reserved words...

Althought Javascript and HTML are very flexible, there are some words you cannot use. You should be able to reference your button by the instance created, and the methods of the original button. But, using the word "button" to name it, is not very bright of yours. Also, do not use tab or any w3c DOM word... I had problems with that :-/ Very sad...
March 25,

This topic is archived.

See also:

Back to support forum


Version 2

Looking for AW 2.6 ?
The old site is here.