Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
185
rated 0 times [  192] [ 7]  / answers: 1 / hits: 18193  / 10 Years ago, thu, march 13, 2014, 12:00:00

I want to add Canvas element into ExtJS Container element. But it accepts only Ext.Component, not any dom element.



Canvas create code:



canvas = document.createElement('canvas');


How to insert it into container, or I need to use another ext component? I need to have some resize logic for component, container have it.


More From » extjs

 Answers
6

The best way to do this is to create a component where the element is the canvas. This way, you get all the built in layout stuff for free basically.



new Ext.container.Container({
width: 400,
height: 400,
layout: 'fit',
items: {
xtype: 'component',
autoEl: {
tag: 'canvas'
}
}
});

[#72012] Wednesday, March 12, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
keric

Total Points: 572
Total Questions: 93
Total Answers: 97

Location: Cyprus
Member since Mon, Oct 24, 2022
2 Years ago
;