PDA

View Full Version : GridPanel top row line missing



rblon
6 Apr 2010, 3:58 AM
I'm using a GridPanel without headers to create a properties window. However, I have the problem that the top row line is missing.

Is that a bug?
I would be grateful for suggestions for a fix.



Ext.onReady(function() {
var store = new Ext.data.ArrayStore({
fields: [
{name: 'property'},
{name: 'value'}
]
});

store.loadData([['Property 1', 100], ['Property 2', 50]]);

var gridPanel = new Ext.grid.GridPanel({
store: store,
columns: [{
id: 'property',
dataIndex: 'property'
}, {
width: 50,
dataIndex: 'value'
}],
autoExpandColumn: 'property',
bodyStyle: 'padding: 10px',
columnLines: true,
disableSelection: true,
hideHeaders: true,
trackMouseOver: false
});

var win = new Ext.Window({
title: 'Properties',
width: 200,
height: 150,
layout: 'fit',
items: gridPanel
});

win.show(this);
});

fay
6 Apr 2010, 4:03 AM
Maybe I'm missing your point, but the top line contains "Property 1" which your image shows...???

rblon
6 Apr 2010, 4:30 AM
sorry, I didn't put it clear: I'm missing the top border line of the first row.

fay
6 Apr 2010, 5:00 AM
I see what you mean now. You could probably just add a getRowClass handler for your GridPanel's viewConfig and return a css class for the first row that contains a border-top style set to solid?

Condor
6 Apr 2010, 5:33 AM
Normally, the headers would be above the rows, but since you used hideHeaders:true the top row doesn't have a top line.

You could move the bodyStyle:'padding:10px' from the grid to the window and make the grid border:true.

rblon
6 Apr 2010, 6:00 AM
thanks for your replies.

Fay's suggestion seems to work. I have implemented it as follows:


...

store.loadData([['Property 1', 100], ['Property 2', 50]]);

var view = new Ext.grid.GridView({
getRowClass: function(record, index) {
if (index == 0) {
return 'border-top-first-row';
}
}
});

var gridPanel = new Ext.grid.GridPanel({
view: view,
store: store,

....


with css class


.border-top-first-row {
border-top: 1px solid #EDEDED;
}


Condor suggestion doesn't work for me (see screenshot), but I can imagine that route with some extra tweaks can work as well.

Should this be reported as a bug?