0

create grid

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;
},


});

by
3 Replies
  • I noticed in your grid control code that you don't have a colon after your styles property:

    CODE
    		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);


    Also, this is not valid:
    CODE
    	config: {
    rows: 2,
    columns: 1,
    dollar_tag_list = [ {text: "Hello world"}, {text: "See ya!"} ]; //not valid syntax
    nombres: ["Jorge","Mariam"]
    },


    There could be more, this is just what leapt out at me. You should be seeing tons of error messages in the logs.

    - Ben
    0
  • Hi Ben, thanks for your fast reply. I know I have a lot of errors in my code, I began using the simulator 3 days ago so I am still experimenting :)Jorge.
    0
  • QUOTE (WidgetRealm @ Oct 18 2010, 05:58 AM) <{POST_SNAPBACK}>
    We provide a bunch of testing widgets, tools, and templates in our ConnectedTV developer accounts. You can sign up here: http://www.widgetrealm.com/developers for access - it is FREE.

    We have a lot of demo widgets and tools to help you with the development process.
    0

Recent Posts

in Getting Started / Beginners - Yahoo! TV Widgets