Reputation: 173
My NatTable
contain CompositeFreezeLayer
composed from viewport, body and selection layer.
I want to disable a row selection for the frozen rows.
That means, in my table I have 15 rows. In these, 5 rows get frozen, that rows should be disabled for selection. And the other 10 rows should be enabled with row/cell selection.
Currently by default all the rows are selecting, may be that should be configured by default through selection layer it seems.
How to disable row selection for only few row?
Upvotes: 1
Views: 333
Reputation: 173
As I want to disable the Row Selection and Cell Selection on Frozen Layer, So Check the instance of both the commands and forwarding the commands.
public class CustomFreezeLayerCommandHandler implements ILayerCommandHandler<ILayerCommand>
{
private int endRowOfFrozenLayer;
public CustomFreezeLayerCommandHandler(final int lastRowOfFrozenLayer)
{
this.endRowOfFrozenLayer = lastRowOfFrozenLayer;
}
@Override
public boolean doCommand(final ILayer targetLayer, final ILayerCommand command)
{
if (command instanceof ViewportSelectRowCommand)
{
return (((ViewportSelectRowCommand) command).getRowPosition() <= this.endRowOfFrozenLayer);
}
else if (command instanceof SelectCellCommand)
{
return (((SelectCellCommand) command).getRowPosition() <= this.endRowOfFrozenLayer);
}
return false;
}
@Override
public Class<ILayerCommand> getCommandClass()
{
return ILayerCommand.class;
}
}
Upvotes: 0
Reputation: 4231
Implement a custom command handler that checks the position and consumes the command for positions in the frozen area. For other rows forward the command. Register that command handler on the CompositeFreezeLayer.
Upvotes: 1