PDA

View Full Version : Grid header resize bars are all wrong!



onlinesaratoga
29 Oct 2007, 6:12 PM
I have a number of grids in my application (paginating grids). For almost all of them in both Firefox and IE, the drag handles (for column resizing) do not line up with the actual grid headers. They are wider.

On the attachment, I have a screenshot which shows the problem. The red lines above the header show where the drag handles indicate the columns are, however you will note that the columns below are not actually in those locations. (As one example, you will see a drag handle through the capital "S" in "Last Sent" and the "R" in "Last Read" and the "e" in "Created".)

Here is the code that makes this grid (although it is happening on all of the grids in my app):



ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: 'store/supportDesk.store.php'
}),

// create reader that reads the Topic records
reader: new Ext.data.JsonReader({
root: 'posts',
totalProperty: 'numPosts',
id: 'postID'
}, [
{name: 'postID', mapping: 'postID'},
{name: 'datePosted', mapping: 'datePosted'},
{name: 'lastUserPost', mapping: 'lastUserPost'},
{name: 'title', mapping: 'title'},
{name: 'name', mapping: 'name'},
{name: 'answered', mapping: 'answered'}
]),

// turn on remote sorting
remoteSort: true
});

ds.on('load',disableButtons);

function showAnswered(v) {
return v > 0 ? "<img border=\"0\" align=\"center\" src=\"images/green_checkmark.gif\">" : "";
}

colModel = new Ext.grid.ColumnModel([
{header: "Date",width:100, sortable: true, locked:false, dataIndex: 'datePosted',renderer: Ext.util.Format.dateRenderer('M d, Y')},
{header: "Topic",width:375, sortable: true, dataIndex: 'title'},
{header: "Posted By", width: 150, sortable: true, dataIndex: 'name'},
{header: "Answered", width: 65, sortable: true, dataIndex: 'answered',renderer:showAnswered,type: 'int',align: 'center'}
]);

supportDeskGrid = new Ext.grid.Grid('supportDeskGrid', {
ds: ds,
cm: colModel,
loadMask: true,
selModel: new Ext.grid.RowSelectionModel({singleSelect:true}),
enableColLock:false,
autoExpandColumn: false,
autoSizeColumns: false
});

supportDeskGrid.selModel.on('rowselect',activateButtons);
supportDeskGrid.selModel.on('rowdeselect',disableButtons);

supportDeskGrid.on("rowdblclick", function(g, row, e) { viewPost(); });

supportDeskGrid.render();

onlinesaratoga
30 Oct 2007, 10:02 AM
No thoughts? Anyone? Bueller? :)

tryanDLS
30 Oct 2007, 10:11 AM
What doctype are you using?

hendricd
30 Oct 2007, 10:14 AM
Have the same issue, but if you notice, if you actually resize any of the column headers the problem, disappears. (Gecko or IE)

That's likely a clue. Somethings not right during initial rendering, but the post-Drag ops are the fixers.

hendricd
30 Oct 2007, 10:15 AM
I've tried it with:




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

and nothing at all

Same-o

onlinesaratoga
30 Oct 2007, 10:42 AM
Glad to know it's not just me! I'm using:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


I have noticed that the problem is often fixed when you manually resize the handles once. I found that if you put:

gridName.getView().fitColumns();

in the onLoad event for the DataStore, it fixes the problem after the render. However, it does seem to me that this is either a bug in ExtJS or some wires are getting crossed in the setup.

hendricd
30 Oct 2007, 10:46 AM
Did a little 'Xray'ing on the column header vs row-cell.

The header width is the same as the cell, but is relative positioned, whereas the Cell is static.

After a header resize-drag the header and row-cell are both statically positioned.

:-?

hendricd
30 Oct 2007, 11:26 AM
But, the resize-drag fix only works if GridView:forceFit=true

hendricd
1 Nov 2007, 7:25 AM
Actually, I just noticed thread was created for 1.1, but I'm having the same issue in 2.0.

Anybody have any more luck on this one?

christ1an
2 Nov 2007, 1:20 AM
Hello,

i had the same problem, when i removed dots ('.') from the IDs (further used as separator) it worked... i have no idea why, but maybe this will help you too...

onlysimchas
6 Nov 2007, 8:52 AM
We had an issue where we used the "From Markup" example which takes an existing HTML table and replaces it with an Ext grid. It only resized the column header, not the bottom part (table body) whenever we dragged the column header divider bar....

Turns out in our case, it appeared to be a bug, where if the table being "enhanced" is inside another HTML table. This behavior is manifested. If we remove the outer table, and, say, put it in a DIV, the problem goes away.

I suspect this is a bug in ext, but I don't know for sure, just sharing how we resolved the issue.