Subscribe Bookmark RSS Feed

How to correctly clear a Row State Handler

txnelson

Super User

Joined:

Jun 22, 2012

I 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
();dt<< select rows(x));

rs = dt << Make Row State Handler(setrow(x));

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?

Jim
1 ACCEPTED SOLUTION

Accepted Solutions
cis_pete

Community Trekker

Joined:

Jan 26, 2015

Solution

Probably 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.

4 REPLIES
cis_pete

Community Trekker

Joined:

Jan 26, 2015

Solution

Probably 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.

pmroz

Super User

Joined:

Jun 23, 2011

I 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);

cis_pete

Community Trekker

Joined:

Jan 26, 2015

Thanks.

ms

Super User

Joined:

Jun 23, 2011

The below seems to clear the row state handler (but not the current row states):

Clear Globals(rs);