0

I dude to do a GridCell

Hey friends,

I'm trying a News Widget and my question is how to make a GridCell.
I have a class called FutbolView.js which work it, but I want to include a GridCell for put 5 or 6 News from top to bottom.
So far I managed to screen out anything that is not a backbutton, a header and a disabledbutton, as the page indicator associated with the grid also missing.

I would show all you my code. If someone could help me I will be very grateful
It have a var titular which have the holder of the new by XML.
CODE
  this.controls.grid =  new KONtx.control.Grid({
id: 'contenedorCeldas',
rows: this.config.rows,
columns: this.config.columns,
styles: {
width: this.width,
height: this.height - this.controls.backbutton.height -
this.controls.disabledButton.height - this.controls.pageindicator.height,
vOffset: this.controls.backbutton.height + this.controls.disabledButton.height,
},

cellCreator: this.imageCellCreator,
cellUpdater: this.imageCellUpdater,
}).appendTo(this)/* Grid */
//this.controls.grid.attachAccesories(this.controls.pageindicator);

imageCellCreator: function(){
var cell = new KONtx.control.GridCell({

events: {
onSelect: function (event){
KONtx.application.loadView("view-DetalleConciertos");
}
}
});
log("var cell creada");
cell.foto = new KONtx.element.Image({
src: "Images/960x540/Basketball.png",
styles: {
vAlign:"center",
hAlign:"center",
height: 46,
width: 46,
vOffset: 12
}
}).appendTo(cell);

cell.nombre = new KONtx.element.Text({
styles: {
color: 'white',
fontSize: '16px',
hOffset: 57,
vOffset: 11,
}
}).appendTo(cell);
log("cell.nombre creado");
},

imageCellUpdater: function(){
cell.nombre.data = titular;

},


A lot of thanks

1 Reply
  • Hi Alvaro,
    The first thing that I noticed is that you're not passing any arguments to your imageCellUpdater method:

    CODE
    imageCellUpdater: function(){
    cell.nombre.data = titular;

    },


    If your titular variable holds an array of data that you want to pass to the grid, you must do it by calling the grid's changeDataset method. For example,

    CODE
    //snipped for brevity....;
    imageCellUpdater: function(cell, dataitem){
    cell.nombre.data = dataitem.nombre;
    },
    //snipped for brevity....;

    updateView: function () {
    this.controls.grid.changeDataset(titular);
    }

    If this confuses you, please consult the docs.

    Also, you commented out the code that attaches the page indicator to the grid (and I'm assuming you've defined this.controls.pageindicator elsewhere).

    Hope this helps.

    - Ben
    0

Recent Posts

in Getting Started / Beginners - Yahoo! TV Widgets