cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
0 Kudos

ability to set a function that would trigger when a tablebox is sorted using <<sort by Column

This is coming to my attention because there are some things that don't seem to work right when a tablebox gets sorted using << sort by column (more so in prior JMP versions).  But this would also be useful if you want to try to line something up next to a tablebox and aligned to some of the table box content.

 

Related to my other wish to have the ability to disable the possibility to sort by Column:option to disable Sort by Column for a tablebox - JMP User Community

4 Comments
SamGardner
Level VII
Status changed to: Needs Info

@hardner have you submitted the table sorting issue you are seeing to JMP Technical Support (support@jmp.com)?  I am wondering what you mean when "some things done seem to work right when a tablebox gets sorted".  

 

Would you also be able to describe the situation and what it is you are trying to do?

In JMP16, you can set for each column in a table a "context menu" that would be available by right-clicking the column header in the table. (search for "Set Context Menu Script") in the Scripting Index (Help > Scripting Index)).  This context menu can have multiple items and allows you to run a script when the context menu item is selected.  You could make your own sort context menu that then would allow you to run whatever JSL you wanted when the table is sorted.  

hardner
Level V

I agree this is solved by the ability to prevent users from sorting the table by overwriting the context menu - a colleague figured this out and it solves both this wish to know that a sort was triggered and another one I had about disabling the user sorting.

 

I did already make a support case about the following :  when a tablebox gets sorted the elements in a colbox that's part of the table do not get rearranged and there appears to be no way to access what row of the table the displaybox  colbox(n)[1] is now on. 

 

for example:

 

 

Names Default To Here( 1 );
New Window( "Mountains",
    tb = Table Box(
        String Col Box( "Mountain", {"K2", "Delphi", "Kilimanjaro", "Grand Teton"} ),
        Number Col Box( "Elevation (meters)", {8611, 681, 5895, 4199} ),
        c = Col Box(
            "",
            Check Box( "" ),
            Check Box( "" ),
            Check Box( "" ),
            Check Box( "" )
        )
    )
);

c[1] << set( 1 );
tb << sortby column( "Mountain" );
Show( (tb[String Col Box( 1 )] << get)[2] );
Show( c[1] << get );
Show( c[2] << get );

 

 

 

mia_stephens
Staff
Status changed to: Delivered

Thank you for updating this post and for providing the example. We're changing the status to Delivered.

hardner
Level V

@SamGardner 

I'm revisiting this having found additional instances where I don't want users to use the context menu to sort a tablebox I've created.

While I did solve this previously by using  <<Set Context Menu Script() for the tablebox to an empty list, now I have the situation where some of the things on that default context menu are wanted.  So I'm working on a replacement list of scripts to recreate some of those as well as add my own function(s).

 

I'm poking you specifically because you noted above that one could newly add a context menu "for each column".  Is that really true? It seems like I can only do that for the whole table and then the scripts involved do not know which column it was selected from.  But maybe I'm missing something? <<setcontextmenuscript() itself is not new in 16 but I don't see anything new in the scripting index about it either (in any newer JMP version).  If I just try it on a column even though the scripting index doesn't indicate you can send this message to that type of box, it doesn't work - but the error is a little odd.  

 

hardner_0-1732221905470.png

 

Maybe I'm just not doing that quite right and it is possible?

This arises because the existing context menu has some things that are column-specific.  If I wanted those, I'm not sure I can replicate them?

I see that JMP18 is adding even more things on that tablebox context menu including more column-specific ones (and via the EA more in 19) but not, that I can see, anything new about disabling ones you don't want, etc. 

 

I also see this other post where @Justin_Chilton says, in the context of suggesting adding a custom script to replace one of the items,  "Please note that you can add some of the other context menu items back if you need them (with a little work) using the JSL message equivalents." Maybe the "some" there is meaning you can't do the column-specific ones? In any case it's more and more work to add items back by making them yourself.

 

This is making me think there are still things to wish for around this... maybe the ability to tell the existing context menu to disable certain options you don't want (by name?) so you can pick and choose?  And then the ability  to add custom items without obliterating the existing menu (my script intends to add custom ones in a section at the bottom after "recreated" ones)?   And then it would be handy if there were a "self" or "this" to reference with your custom script that would link you to the specific column it was activated from (and thence to the tablebox). I think that would actually be handier than having to give each column its own.