BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
txnelson
Super User

How to correctly clear a Row State Handler

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
0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
cis_pete
Community Trekker

Re: How to correctly clear a Row State Handler

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.

0 Kudos
5 REPLIES 5
cis_pete
Community Trekker

Re: How to correctly clear a Row State Handler

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.

0 Kudos
pmroz
Super User

Re: How to correctly clear a Row State Handler

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

0 Kudos
Highlighted
cis_pete
Community Trekker

Re: How to correctly clear a Row State Handler

Thanks.

0 Kudos
ms
Super User ms
Super User

Re: How to correctly clear a Row State Handler

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

Clear Globals(rs);

thomasz
Community Trekker

Re: How to correctly clear a Row State Handler

An old question, but why not just setting rs=0 ?

0 Kudos