Reputation: 46802
I have a handler function that is updating a quite large UI with values from a spreadsheet. The rowindex of the sheet comes from a callbackElement as e.parameter.hidden
(hidden is the widget that holds the value) and that I increment/decrement in the function.
I have another handler function that searches the spreadsheet for a string value and returns a rowindex that I assign to this same hidden widget.
If I trigger the 'search' handler first and then the 'display' handler, I have my UI updated with the 'found' data, which is nice but needs two separate clicks on two distinct buttons.
Now my question : how could I include in the 'search handler function' a call to the 'display handler' and pass all e.parameters BUT modify the value of the e.parameter.hidden
only ?
I know e
is an object with a lot of keys and values but I don't know how to manipulate just one value in there...
The code of the search handler is very short and goes like this :
function findname(e){ // this function is called by a handler triggered by a keypress on a textBox
var app = UiApp.getActiveApplication();
var hiddenD = app.getElementById('hiddenD');
var str = e.parameter.find ; // find is the textBox's name
var found = point(str);// point() is a function that returns the rowindex of the found value
hiddenD.setValue(found);// hiddenD is the hidden widget that I want to 'manipulate'
nextitem(e);// nextitem is the function that updates the UI and that is normally called by a handler on another button
return app
}
Well I hope this question is clear enough (this wasn't easy to explain), if not please ask ;-)
Upvotes: 0
Views: 598
Reputation: 3732
e is just a json data which you can manipulate by its key.
Code skeleton is like
searchHandlerFunction(e){
//Your all other sttements
//Assign the new value to hidden parameter
e.parameter.hidden = <your new value>;
DisplayFunction(e);
}
Upvotes: 1
Reputation: 7957
Why don't you simply store the rowIndex as a CacheService property ? I'm using this with a lot of success in lieu of hidden fields and hidden text boxes.
You can call them from anywhere and modify them anywhere.
Upvotes: 1