Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Dynamically set column span for a cell(i want to randomly set column span for a cell based on value in other column)
Dynamically set column span for a cell [message #1800783] Tue, 08 January 2019 08:52 Go to next message
Shreya Suman is currently offline Shreya SumanFriend
Messages: 13
Registered: March 2017
Junior Member
My requirement is to based on a value selected in a column of nattable, i want to set a custom text by merging few other column and make it non-editable.

i am able to achieve the non-editable cell using label configuration but i am not able to achieve row spanning / merging dynamically,

i have defined in my get cell as:

public DataCell getCellByPosition(int columnPosition, int rowPosition)
{
int columnSpan = 1;
int rowSpan = 1;
int cellColumnPosition = columnPosition;
int cellRowPosition = rowPosition;

//Merge the load current cells if component is excluded from fuse size analysis
if(rowObj.isExcludedFromFuseSizeAnalysis())
{
if(cellColumnPosition == gfsConstant.NOM_COL_IDX)
{
columnSpan = 6;
}
}
return new DataCell(cellColumnPosition, cellRowPosition, columnSpan, rowSpan);
}


when i save the data in database and after i reload the table the span is showing correctly, but i want it to display as soon as i edit the property in other column.

Can someone please help me in how to achieve this.

  • Attachment: Capture.PNG
    (Size: 14.70KB, Downloaded 129 times)
Re: Dynamically set column span for a cell [message #1800785 is a reply to message #1800783] Tue, 08 January 2019 09:41 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I suppose you need to trigger a NatTable#refresh() after updating the value. You should be able to do this by either registering a custom UpdateDataCommandHandler to the body DataLayer or by registering a listener for a DataUpdateEvent that triggers the refresh if the update contains the value. At least that would be my assumption without seeing any other code or having a simple example to reproduce this.
Previous Topic:Problem with Column Group Reorder and Column Grouping by Value
Next Topic:Problem with Tree and Hide Row
Goto Forum:
  


Current Time: Thu Apr 25 13:32:03 GMT 2024

Powered by FUDForum. Page generated in 0.02896 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top