Hi, my english is bad, so be patient.
Im trying to create a grid, and my code have any problem. And I cannot see the grid in the sidebar view and I have been trying to find the error, but I couldnt find it.
Could anybody help me??. My code is the following.
CODE
var data_list = [];
getDataList = function () {
data_list = [ {text: "Hello world"}, {text: "See ya!"} ];
};
var MenuEvents = new KONtx.Class({
ClassName: 'MenuEvents',
Extends: KONtx.system.SidebarView,
config: {
rows: 2,
columns: 1,
dollar_tag_list = [ {text: "Hello world"}, {text: "See ya!"} ];
nombres: ["Jorge","Mariam"]
},
createView: function() {
getDataList();
this.controls = {};
this.controls.textCelda = new KONtx.element.Text({
label: "labelText",
styles: {
color: "#ffffff",
fontSize: KONtx.utility.scale(20),
vAlign: "center",
hAlign: "center"
},
}).appendTo(this);
this.controls.backButton = new KONtx.control.BackButton({
id: 'BackButton',
label: 'Image Grid'
}).appendTo(this);
this.controls.grid = new KONtx.element.Grid({
id: 'CalendarGrid',
rows: 2,
columns: 3,
carousel: true,
cellCreator: this._cellCreator,
cellUpdater: this._cellUpdater,
//manageWaitIndicator: true,
styles{
width: this.width,
height: this.height -
this.controls.backButton.height,
vOffset: this.controls.backButton.height
},
}).appendTo(this);
},
updateView: function() {
this.controls.grid.changeDataset(this.data_list,true,this.config.nombres.length - 1);
}
},
_cellCreator: function(){
//We need to setup a "Cell" to be created insode the Grid
var cell = new KONtx.control.GridCell({
styles: {
width: 4,
height: 4
},
events: {
// this onSelect fires in context of cell
onSelect: function (event){
log('\n\n---------------\nHemos clicado en la celda:\n');
}
}
});
cell.textLabel = new KONtx.element.Text({
label: '',
styles: {
vOffset: 0,
color: '#FFFFFF',
fontSize: KONtx.utility.scale(18),
hAlign: 'center',
}
}).appendTo(cell);
return cell;
},
_cellUpdater: function(cell, dataitem) {
log('Inside Updater');
cell.textLabel.setText(dataitem.text);
//cell.originalButtonNumber = dataitem.buttonNumber;
},
});