Remove Grid Line in Tableview

Remove grid line in tableView

I assume you're asking about JavaFX 2. If not, I suggest you upgrade :)

Try putting this in your stylesheet:

.table-view {
-fx-table-cell-border-color: transparent;
}

Or call

tableObject.setStyle("-fx-table-cell-border-color: transparent;")

In order to keep horizontal lines, I had to do the following

.table-view .table-row-cell {
-fx-border-width: 1;
}

There's probably a better way to do this, but this worked for me...

Remove grid line in JavaFX TableView when cell is focused [that cyan one]

This troubled me as well.

.table-row-cell{ 
-fx-table-cell-border-color: transparent;
}

This should do the job.

Disappearing horizontal grid lines in JavaFX tableview

By default, a cell has this styling:

.table-cell {
-fx-padding: 0.166667em; /* 2px, plus border adds 1px */
-fx-background-color: null;
-fx-border-color: transparent -fx-table-cell-border-color transparent transparent;
-fx-cell-size: 2.0em; /* 24 */
-fx-text-fill: -fx-text-background-color;
}

By default, the only border with color is the right one (black).

Since in your cell factory you are setting the background color to not null, this is overlapping the default border. So the solution is easy, you just need to set the color for the bottom border too:

@Override 
protected void updateItem(Color color, boolean empty) {
super.updateItem(color, empty);

int r = (int) (color.getRed() * 255);
int g = (int) (color.getGreen() * 255);
int b = (int) (color.getBlue() * 255);

if (empty || color == null) {
this.setStyle("-fx-background-color: white; "
+ "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;");
} else {
this.setStyle("-fx-background-color: rgb(" + r + "," + g + "," + b + ");"
+ "-fx-border-color: transparent -fx-table-cell-border-color -fx-table-cell-border-color transparent;");
}

}

How to hide grid lines in JTable

you have to set two thingies

  • disable grid showing
  • zero row/column intercell spacing

In code:

table.setShowGrid(false);
table.setIntercellSpacing(new Dimension(0, 0));

Or use JXTable (from the SwingX project) which does it for you:

xTable.setShowGrid(false, false);

delete lines between UITableViewCells in UITableView

Using Objective-C, we have:

[self.tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone];

for Swift 3:

self.tableView.separatorStyle = .none

for Swift 2:

self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None

OR:

if you are using the InterfaceBuilder, you can set the tableView's Separator property to None
Sample Image

Remove horizontal lines in TableView in JavaFX 8 using CSS

I actually found the answer for my own question, in order to remove all the white lines, I only add the following lines to the css file:

.root .table-view{
-fx-control-inner-background: #AB4642;
}

And the work is done!. Thanks to James_D for trying to help me.

How to hide NSTableView gridlines / seperators for empty items

I have figured out one way:

In interface builder, set the 'row height' of the tableview to a very large number i.e. 10000, and make it 'Fixed'. In the delegate implement the tableView:heightOfRow:

e.g. in swift:

func tableView(tableView: NSTableView!, heightOfRow row: Int) -> CGFloat {
return 50
}

This means that cells that don't have content are so big that you can't see the gridlines, as the above method seems to only get called for existing cells.

The other way as per Elwisz' comment, is to implement drawBackgroundInRect: of NSTableRowView.

Remove horizontal gridlines from QTableWidget in PyQt

I don't think there's a built-in method, however you can remove horizontal gridlines via stylesheets by disabling gridlines using setShowGrid(False) and then drawing the vertical line borders with the QTableView::item selector and the border-right style like this:

tableWidget.setShowGrid(False)
tableWidget.setStyleSheet('QTableView::item {border-right: 1px solid #d6d9dc;}')

Sample Image

Here's a quick example

from PyQt5.QtWidgets import QApplication, QWidget, QTableWidget, QTableWidgetItem, QVBoxLayout
import sys

class Table(QWidget):
def __init__(self):
super().__init__()
self.setGeometry(0, 0, 300, 200)
self.create_table()
self.layout = QVBoxLayout()
self.layout.addWidget(self.tableWidget)
self.setLayout(self.layout)
self.show()

def create_table(self):
self.tableWidget = QTableWidget()
self.tableWidget.setRowCount(4)
self.tableWidget.setColumnCount(2)
self.tableWidget.setItem(0,0, QTableWidgetItem("Cell (1,1)"))
self.tableWidget.setItem(0,1, QTableWidgetItem("Cell (1,2)"))
self.tableWidget.setItem(1,0, QTableWidgetItem("Cell (2,1)"))
self.tableWidget.setItem(1,1, QTableWidgetItem("Cell (2,2)"))
self.tableWidget.setItem(2,0, QTableWidgetItem("Cell (3,1)"))
self.tableWidget.setItem(2,1, QTableWidgetItem("Cell (3,2)"))
self.tableWidget.setItem(3,0, QTableWidgetItem("Cell (4,1)"))
self.tableWidget.setItem(3,1, QTableWidgetItem("Cell (4,2)"))
self.tableWidget.move(0,0)

# Remove horizontal gridlines
self.tableWidget.setShowGrid(False)
self.tableWidget.setStyleSheet('QTableView::item {border-right: 1px solid #d6d9dc;}')

if __name__ == '__main__':
app = QApplication(sys.argv)
table = Table()
sys.exit(app.exec_())

Note: If you wanted to remove vertical gridlines, change the style from border-right to border-bottom

Sample Image

remove seperator line of table view cell in xib

You must remove the separator line in the Attributes inspector of the tableview like in the image below:

Sample Image



Related Topics



Leave a reply



Submit