I want to create a matrix, where every element of the matrix is a custom component. I don't want to use grid. Below is the sample code which i made it should give rectangular boxes all over the page, which is my requirement as well. But its throwing script error because of looping and creation of so many cell instance. and i shouldn't have extended panel here i know but i am knew to ExtJS, it worked initially so i kept it. My first question is 'Is my approach correct?' and second is 'what can i do to solve the script error because i do need all those boxes?'.
Ext.application({
requires: ['Ext.container.Viewport'],
name: 'Excel',
launch: function() {
Ext.define('Cell',{
extend: 'Ext.panel.Panel',
itemcls: 'cell',
height: 20,
width: 64
});
var port = Ext.create('Ext.container.Viewport', {
layout: 'absolute'
});
var totalRowsToDraw = port.height/20;
var totalColumnsToDraw = port.width/64;
var cell;
for(var r=0; r < totalRowsToDraw ;r++){
for(var c=0; c < totalColumnsToDraw ;c++){
cell = Ext.create('Cell');
cell.x = c*64;
cell.y = r*20;
port.add(cell);
}
}
}
});
Cellobjects, though it does take at least 20-30 seconds to complete. - forgivensonExt.panel.Panelis a very large component, so if you tell me exactly what your are trying to make, then I can suggest a betterExtcomponent to use. - forgivenson