Hi Martin,

I was meditating on this problem tonight, and I see two scenarios:

a) create a cellrenderer.Canvas which adds a canvas tag with a
   running id into the table and adds the values with the id into a
   queue.

        _getContentHtml : function(cellInfo) {
            var id = this.__id+cellInfo.row+'x'+cellInfo.col;
            this.__queue.push([id,cellInfo.value]);
            return "<canvas id='"+id+"'></canvas>";
        },

   using the  paneReloadsData I would then call the new 'update'
   method on the cellrenderer object, causing it to render all the
   canvas elements in the __queue, much like you suggested below.

on the other hand,

b) my use case is such that I am updateing the table every few
   seconds with new data coming from the server. Since I am
   replacing the entire table content on every update I wonder if
   this is the most efficient thing todo, especially since the table
   is only 10 - 100 lines long. I can see the browser using an
   increassing amount of memory as the table is being updated ...

if the table aproach does not work I will try the grid layout
instead. This would would also solve the canvas issue since the
grid can contain normal widgets ...

cheers
tobi

Yesterday MartinWittemann wrote:

>
> Hello Tobi,
>
> I just tried reproduce your problem but I guess there is no event exactly
> dedicated to such a scenario. I tried the paneReloadsData of the table pane
> and it worked more or less. Take a look at the modified table playground
> example to see how you could do it.
>
> function createRandomRows(rowCount) {
>   var rowData = [];
>   var nextId = 0;
>   for (var row = 0; row < rowCount; row++) {
>     rowData.push([ nextId++, " abc " ]);
>   }
>   return rowData;
> }
>
> // window
> var win = new qx.ui.window.Window("Table").set({
>   layout : new qx.ui.layout.Grow(),
>   contentPadding: 0
> });
> this.getRoot().add(win);
> win.open();
>
> // table model
> var tableModel = new qx.ui.table.model.Simple();
> tableModel.setColumns([ "ID", "HTML" ]);
> tableModel.setData(createRandomRows(10));
>
> // table
> var table = new qx.ui.table.Table(tableModel).set({
>   decorator: null
> })
> win.add(table);
>
> // table column model
> var tcm = table.getTableColumnModel();
> tcm.setDataCellRenderer(1, new qx.ui.table.cellrenderer.Html());
>
> var scroller = table.getPaneScroller(0);
> var pane = scroller.getTablePane();
> pane.addListener("paneReloadsData", function() {
>   console.log(document.getElementById("xx1"));
> }, this);
>
> Anyway, I will talk to Fabian, who is our Table maintainer. Perhaps he has a
> more elegant solution to this.
> Best,
> Martin
>
>
> oetiker wrote:
> >
> > Folks,
> >
> > I would like to place a canvas element into a table cell. Putting
> > the <canvas></canvas> html there is simple, but since I need access
> > to the DOM element to paint on the canvas and in the cellrenderer
> > I am only dealing with a html string I am a bit lost as to the best
> > aproach for this ...
> >
> > is there some event which I could listen for as to when the cells
> > html is put into the DOM ?
> >
> > cheers
> > tobi
> >
> >
> > --
> > Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
> > http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900
> >
> > ------------------------------------------------------------------------------
> > Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> > 30-Day
> > trial. Simplify your report design, integration and deployment - and focus
> > on
> > what you do best, core application coding. Discover what's new with
> > Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> > _______________________________________________
> > qooxdoo-devel mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> >
> >
>
>

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to