PDA

View Full Version : Trying to use canvas in a Ext.dataView



enriqueaf
28 Nov 2009, 8:56 AM
Hello!!
I'm trying to use canvas to draw a background inside a Ext.dataView which uses an store and a xtemplate for draw some objects. But I'm having some problems:


I can't find and event which fires after the xTemplate have rendered the objects and dataView has shown them.
This part concernd only html/css but I don't know how to adjust the size of the canvas element to be under all the objects which I have created with the xtemplate (Note: I am using boxes which exceed the size so It uses the overflow)

Thank you, and If you don't undertand what I am asking, say it.

Enrique

Condor
28 Nov 2009, 10:33 AM
There is no event, so you'll have to do an inline override.

Is the data in the store static (add, update and delete events cause a dataview to change)?

If it displays static data you can override the 'refresh' method, otherwise I would recommend overriding the 'updateIndexes', because it is called after every change.

Example:

var dataview = new Ext.DataView({
...
refresh: function(){
this.constructor.prototype.refresh.call(this);
// all the items are now rendered
}
});

enriqueaf
28 Nov 2009, 11:13 AM
Thank you, very much, I have done it in that way but I was looking for a way in which I didn't need to override that method, but It works, thanks. Now I am havingo so much trouble trying to complete the step 2, making the canvas to adjust to the parent div, includind the overflow, I mean that the canvas image scroll with the scroll without need to specify the width and height.

Thank you
Enrique