JSL如何让光标点击某个单元格与表格其他列的相同值自动高亮该单元格?例如,使用以下 JSL 将大类的 name 列复制另外两列。
如何使用 JSL:当光标单击某个单元格时,该单元格会自动将表格其他列中相同值的背景设置为红色。
谢谢!
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Select Where( 1 );
dt << Select Columns( "name" );
d2 = dt << Subset( Output Table( "t" ), Selected Rows( 1 ), columns( name ) );
Column( d2, 1 ) << set name( "n1" );
dt << Sort( By( 4 ), Order( Descending ), replace table );
dt << Update( With( d2 ) );
Close( d2, nosave );
dt << Select Where( 1 );
dt << Select Columns( "name" );
d2 = dt << Subset( Output Table( "t" ), Selected Rows( 1 ), columns( name ) );
Column( d2, 1 ) << set name( "n2" );
dt << Sort( By( 5 ), Order( Descending ), replace table );
dt << Update( With( d2 ) );
Close( d2, nosave );

自动化和脚本编写Re: JSL如何让光标点击某个单元格与表格其他列的相同值自动高亮该单元格?您需要将事件处理程序添加到:name。我认为这就是您正在寻找的:
Function( {thisTable, thisColumn, iRow},
{},
n1rows = thisTable << Get Rows Where( :n1 == thisTable:thisColumn[iRow] );
n2rows = thisTable << Get Rows Where( :n2 == thisTable:thisColumn[iRow] );
thisTable << Select Columns( {thisColumn, :n1, :n2} ) << Clear Cell Colors;
thisColumn << Color Cells( {3, {iRow}} );
:n1 << Color Cells( {3, n1rows} );
:n2 << Color Cells( {3, n2rows} );
);添加列属性:

希望有帮助!
Re: JSL如何让光标点击某个单元格与表格其他列的相同值自动高亮该单元格?谢谢!

Re: JSL如何让光标点击某个单元格与表格其他列的相同值自动高亮该单元格?Re: JSL如何让光标点击某个单元格与表格其他列的相同值自动高亮该单元格?谢谢!