By the way, I realise that the scripted example I gave could be easily solved by adding
rs = dt << make row state handler( f );
immediately after my Sort() command. It's the interactive case (where a user manually sorts the table by a column then selects a row) that is the issue.
I tried a workaround by adding a script to the table which resets the row state handler:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
f = Function( {a}, Print( a ) );
rs = dt << make row state handler( f );
dt << new script("Fix Row State Handler",
rs = dt << make row state handler( f );
); // errors when the script is run!
dt << Select Rows( 1 );
wait(0);
dt << sort( by( :weight ), replace table, order( ascending ) );
rs = dt << make row state handler( f ); // fixes issue when scripting
dt << Select Rows( 9 );
but I get an error when i click the green triangle to run the script:
Send Expects Scriptable Object in access or evaluation of 'Send' , dt << /*###*/make row state handler( f ) /*###*/ at line 6 in ...
However, even if this worked it would not be ideal since it requires a user to remember to do this after sorting the table.
Thanks,
Matthew.