On Mon, Jul 19, 2010 at 12:44, danovics <[email protected]> wrote:
>
> Hi Thron
>
> I've problem when implementing your solution.
> I make somewhere a mistake but can't find out where.
> Could you help me, please?
>
> I've tried to make a new class MyScroller which is extends the
> qx.ui.table.pane.Scroller.
> It has nothing inside, just the extend key - for testing purpose.
> Before I initiate my table I've done:
> var custom =
> {
> tablePaneScroller : function(obj)
> {
> return new path.to.MyScroller(obj);
> }
> };
> var table = new qx.ui.table.Table(tableModel, custom);
> The tableModel's been defined before.
> Without passing custom to qx.ui.table.Table's constructor everything is
> working fine.
> But passing the custom I'm getting error in firebug.
>
> I should be blind...
>
>
No, you're not blind. It doesn't work in the playground. I have no idea why,
and don't have the time to track it down right now. It does, however, work
in a "real" application.
Run qooxdoo's create-application script:
.../qooxdoo/tool/bin/create-application.py -n test
In the source/class/test/Application.js file, remove all of the junk where
it says, "Your application goes here" (or something like that). In its
stead, place this code:
function createRandomRows(rowCount) {
var rowData = [];
var now = new Date().getTime();
var dateRange = 400 * 24 * 60 * 60 * 1000; // 400 days
var nextId = 0;
for (var row = 0; row < rowCount; row++) {
var date = new Date(now + Math.random() * dateRange - dateRange /
2);
rowData.push([ nextId++, Math.random() * 10000, date,
(Math.random() > 0.5) ]);
}
return rowData;
}
// window
var win = new qx.ui.window.Window("Table").set({
layout : new qx.ui.layout.Grow(),
allowClose: false,
allowMinimize: false,
contentPadding: 0
});
this.getRoot().add(win);
win.moveTo(30, 40);
win.open();
// table model
var tableModel = new qx.ui.table.model.Simple();
tableModel.setColumns([ "ID", "A number", "A date", "Boolean" ]);
tableModel.setData(createRandomRows(1000));
// make second column editable
tableModel.setColumnEditable(1, true);
var custom =
{
tablePaneScroller : function(obj)
{
return new test.Scroller(obj);
}
};
// table
var table = new qx.ui.table.Table(tableModel, custom).set({
decorator: null
});
win.add(table);
var tcm = table.getTableColumnModel();
// Display a checkbox in column 3
tcm.setDataCellRenderer(3, new qx.ui.table.cellrenderer.Boolean());
// use a different header renderer
tcm.setHeaderCellRenderer(2, new
qx.ui.table.headerrenderer.Icon("icon/16/apps/office-calendar.png", "A
date"));
Then create a new file in the same directory as Application.js, called
Scroller.js. Place the following in that file:
// We want our own Scroller to be used
qx.Class.define("test.Scroller",
{
extend : qx.ui.table.pane.Scroller,
members :
{
_startMoveHeader : function()
{
}
}
});
Now run the generator, and then load the page in your browser. You'll see
that it works. (Kind of. Although you don't get an error and the code works
as advertised, i.e. it prevents moving the header, when you try to drag the
header, it ends up changing the sort order of some other column. That's a
different problem that you'll have to solve somehow.)
Derrell
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel