0

Grid cellCreator not called

Hi,
I am a newbie to Yahoo Tv Widgets . I am trying to create grid with only one cell, which contains a Text control. But when I execute it, I dont see the label of the Text control in the Konfabulator. It looks like the cellCreator is not getting executed. Please help.

Here is my code,


var taglistview = new KONtx.Class({
ClassName: 'taglistview',

Extends: KONtx.system.SidebarView,

createView: function() {
getTagList();




this.controls.listGrid = new KONtx.control.Grid({
columns: 1,
rows: 1,
carousel: true,

cellCreator: this.tagcellCreator,
cellUpdater: this.tagcellUpdater,
styles: {
vOffset: 0,
width: this.width,
height: this.heigth
},

}).appendTo(this);

this.controls.pageindicator = new KONtx.control.PageIndicator({
id: 'TagPageIndicator',
styles: {
vAlign: 'bottom'
//vOffset: this.height
},
events: {
onSelect: function(event) {

log("You selected Page Indicator");
}
}
}).appendTo(this);

this.controls.listGrid.attachAccessories( this.controls.pageindicator);
this.updateGridData($taglist);

},

tagcellCreator: function() {
log('Inside Creator');
var cell = new KONtx.control.GridCell({
styles: {

width: this.width,
},
events: {
onSelect: function(event) {

log("You selected a Text ");
}
}
});
cell.textLabel = new KONtx.element.Text({
label: '',
styles:
vOffset: 0,
color: '#FFFFFF',
fontSize: KONtx.utility.scale(18),
hAlign: 'center',


}).appendTo(cell);
return cell;
},

updateGridData: function($taglist){
if($taglist instanceof Array && this.controls.listGrid instanceof
KONtx.control.Grid){

this.controls.listGrid.changeDataset($taglist);
}
},

tagcellUpdater: function(cell, dataitem) {
log('Inside Updater');
cell.textLabel.label = dataitem.text;
//cell.originalButtonNumber = dataitem.buttonNumber;
}
});


Thank You.
Ganesh

by
2 Replies
  • I found 4 issues that must be fixed, and a few others I would change, but not the problem here.

    var dollar_tag_list = []; // ERROR: My simulator doesn't like $tagList, but likes dollar_tag_list
    // height: this.heigth // ERROR: typo
    // styles: // ERROR: missing {
    // cell.textLabel.label = dataitem.text; // ERROR: .label only makes sense at creation time



    CODE
    var dollar_tag_list = []; // ERROR: My simulator doesn't like $tagList, but likes dollar_tag_list
    getTagList = function () {
    dollar_tag_list = [ {text: "Hello world"}, {text: "See ya!"} ];
    };

    var taglistview = new KONtx.Class({
    ClassName: 'taglistview',

    Extends: KONtx.system.SidebarView,

    createView: function() {
    getTagList();

    this.controls.listGrid = new KONtx.control.Grid({
    columns: 1,
    rows: 1,
    carousel: true,

    cellCreator: this.tagcellCreator,
    cellUpdater: this.tagcellUpdater,
    styles: {
    vOffset: 0,
    width: this.width,
    // height: this.heigth // ERROR: typo
    height: this.height
    },

    }).appendTo(this);

    this.controls.pageindicator = new KONtx.control.PageIndicator({
    id: 'TagPageIndicator',
    styles: {
    vAlign: 'bottom'
    //vOffset: this.height
    },
    events: {
    onSelect: function(event) {

    log("You selected Page Indicator");
    }
    }
    }).appendTo(this);

    this.controls.listGrid.attachAccessories( this.controls.pageindicator);
    this.updateGridData(dollar_tag_list);
    },

    tagcellCreator: function() {
    log('Inside Creator');
    var cell = new KONtx.control.GridCell({
    styles: {
    width: this.width,
    },
    events: {
    onSelect: function(event) {
    log("You selected a Text ");
    }
    }
    });
    cell.textLabel = new KONtx.element.Text({
    label: '',
    // styles: // ERROR: missing {
    styles: {
    vOffset: 0,
    color: '#FFFFFF',
    fontSize: KONtx.utility.scale(18),
    hAlign: 'center',
    }
    }).appendTo(cell);
    return cell;
    },

    updateGridData: function(dollar_tag_list){
    if(dollar_tag_list instanceof Array && this.controls.listGrid instanceof
    KONtx.control.Grid){

    this.controls.listGrid.changeDataset(dollar_tag_list);
    }
    },

    tagcellUpdater: function(cell, dataitem) {
    log('Inside Updater');
    // cell.textLabel.label = dataitem.text; // ERROR: .label only makes sense at creation time
    cell.textLabel.setText(dataitem.text);
    //cell.originalButtonNumber = dataitem.buttonNumber;
    }
    });


    Hope that helps!
    0
  • Thank You.
    I was able to fix the issues and its working now. I included updateview to populate the dataset.





    QUOTE (jsl4tv @ Sep 2 2010, 11:44 AM) <{POST_SNAPBACK}>
    I found 4 issues that must be fixed, and a few others I would change, but not the problem here.

    var dollar_tag_list = []; // ERROR: My simulator doesn't like $tagList, but likes dollar_tag_list
    // height: this.heigth // ERROR: typo
    // styles: // ERROR: missing {
    // cell.textLabel.label = dataitem.text; // ERROR: .label only makes sense at creation time



    CODE
    var dollar_tag_list = []; // ERROR: My simulator doesn't like $tagList, but likes dollar_tag_list
    getTagList = function () {
    dollar_tag_list = [ {text: "Hello world"}, {text: "See ya!"} ];
    };

    var taglistview = new KONtx.Class({
    ClassName: 'taglistview',

    Extends: KONtx.system.SidebarView,

    createView: function() {
    getTagList();

    this.controls.listGrid = new KONtx.control.Grid({
    columns: 1,
    rows: 1,
    carousel: true,

    cellCreator: this.tagcellCreator,
    cellUpdater: this.tagcellUpdater,
    styles: {
    vOffset: 0,
    width: this.width,
    // height: this.heigth // ERROR: typo
    height: this.height
    },

    }).appendTo(this);

    this.controls.pageindicator = new KONtx.control.PageIndicator({
    id: 'TagPageIndicator',
    styles: {
    vAlign: 'bottom'
    //vOffset: this.height
    },
    events: {
    onSelect: function(event) {

    log("You selected Page Indicator");
    }
    }
    }).appendTo(this);

    this.controls.listGrid.attachAccessories( this.controls.pageindicator);
    this.updateGridData(dollar_tag_list);
    },

    tagcellCreator: function() {
    log('Inside Creator');
    var cell = new KONtx.control.GridCell({
    styles: {
    width: this.width,
    },
    events: {
    onSelect: function(event) {
    log("You selected a Text ");
    }
    }
    });
    cell.textLabel = new KONtx.element.Text({
    label: '',
    // styles: // ERROR: missing {
    styles: {
    vOffset: 0,
    color: '#FFFFFF',
    fontSize: KONtx.utility.scale(18),
    hAlign: 'center',
    }
    }).appendTo(cell);
    return cell;
    },

    updateGridData: function(dollar_tag_list){
    if(dollar_tag_list instanceof Array && this.controls.listGrid instanceof
    KONtx.control.Grid){

    this.controls.listGrid.changeDataset(dollar_tag_list);
    }
    },

    tagcellUpdater: function(cell, dataitem) {
    log('Inside Updater');
    // cell.textLabel.label = dataitem.text; // ERROR: .label only makes sense at creation time
    cell.textLabel.setText(dataitem.text);
    //cell.originalButtonNumber = dataitem.buttonNumber;
    }
    });


    Hope that helps!
    0

Recent Posts

in Design / Interaction - Yahoo! TV Widgets