How to correctly clear a Row State HandlerI have a very simple Row State Handler that makes sure that a given selected row can never be unselected. The issue is, that I want to turn off that functionality and continue with normal operations.
Here is the simple script that locks down row 15 to always be selected.
names default to here(1);
dt=open("$SAMPLE_DATA\big class.jmp");
x=15;
dt << select rows(x);
setrow = function({x},dt<<CLEAR select=""></CLEAR>
So now the question is, how do I remove the Row State Handler, short of closing and reopening the data table? I can change the rowstate handler to a different function, but I would prefer to just remove the Row State Handler.
Does anyone have an answer?
Automation and ScriptingData AccessDesign of ExperimentsMass CustomizationRe: How to correctly clear a Row State HandlerI think that you only need to assign empty to the variable that previously stored the reference to the handler. You need to use a Wait( 0 ) function call before de-assigning the handler to make sure that all updates are caught up and the script is in sync. (Thanks to Dan Schikore for the tip about Wait.)
See this example and examine the Log after it runs. Only the first two row state changes cause output to the Log.
Names Default To Here( 1 );
// example data set
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
// example handler
f = Function( {a}, Show( a ) );
// assign handler
rs = dt << make row state handler( f );
// test handler
dt << Select Rows( 1 );
dt << Select Rows( 5 );
Wait( 0 );
// de-assign handler
rs = Empty();
// test absence of handler
dt << Select Rows( 3 );
dt << Select Rows( 9 );Re: How to correctly clear a Row State HandlerAn old question, but why not just setting rs=0 ?
Re: How to correctly clear a Row State Handler<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />The below seems to clear the row state handler (but not the current row states):
Clear Globals(rs);
Re: How to correctly clear a Row State HandlerThanks.
Re: How to correctly clear a Row State HandlerI copy/paste JSL code to MS-Word, then copy/paste it from Word to here. For example:
empty_function = function({x},{z},
z = 1;
);
rs = dt << Make Row State Handler(empty_function);
Re: How to correctly clear a Row State HandlerProbably not the correct solution but I assign an empty function to the row state handler:
empty_function = function({x},{z},
z = 1;
);
rs = dt << Make Row State Handler(empty_function);
Somehow it does not work if the function is completely empty, so I added z=1 as 'dummy code'.
Regards
Peter
PS: How can you format sample code as 'code' (like you did)? Seems like I am too dumb to understand the forum software.