0

Pager utility - what am I doing wrong?

Below is my current code from playing around with the pager utility, however, I am seeing an error stating

"WE 00:00:12:158: [T:7807] TypeError: this.controls.grid has no properties (sidebar.js: Line 126)" - which is refering to this:

CODE
	updateView: function (){
this.controls.grid.changeDataset([], true);
},



any ideas what the problem might be - as I am banging my head against the wall on this

Full code:

CODE
/**
* @author pkelly
*/

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

Extends: KONtx.system.SidebarView,

config: {
rows: 3,
columns: 3
},
initialize: function() {
this.parent();

},
createView: function (){

var __baseID = (this.id||this.ClassName||this._ktxID+'.ImageGrid');

this.controls = {};
var pageSize = 1;
var fetchSize = 5;
var howMany = 5;
var fetchParams = {'page':1, 'per_page':9};
var my_pager = new KONtx.utility.Pager(pageSize, fetchSize, this.fetchData(fetchParams, this.handleFetchResponse.bindTo(this)), this, howMany);
my_pager.initItems(this.cache.imgData, this.totalDatasetSize);

this.controls.headerText = new KONtx.element.Text({
label: "My Recent Photos",
wrap: true,
truncation: 'end',
styles: {
fontSize: '20px',
color: '#FFFFFF',
textAlign: 'left',
width: this.width,
height: 36,
hOffset: 5
}
}).appendTo(this);

//
// if this seems goofy, it's because we need to create the page
// indicator and metadata container first so we can measure their
// height and fit the grid in last.
//
this.controls.pageindicator = new KONtx.control.PageIndicator({
id: __baseID+'.PageIndicator',
styles: {
vAlign: 'bottom',
vOffset: this.height
}
}).appendTo(this);

this.controls.metadata = new KONtx.control.MetadataDisplay({
id: __baseID+'.Metadata',
styles: {
height: 23,
vAlign: 'bottom',
vOffset: this.height - this.controls.pageindicator.height
}
}).appendTo(this);

this.controls.grid = new KONtx.control.Grid({
id: __baseID+'.Grid',
pager:my_pager,
rows: this.config.rows,
columns: this.config.columns,
styles: {
width: this.width,
height: this.height -
this.controls.headerText.height -
this.controls.pageindicator.height -
this.controls.metadata.height,
vOffset: this.controls.headerText.height
},
cellCreator: this.imageCellCreator,
cellUpdater: this.imageCellUpdater
}).appendTo(this);

//
// and now that everyone's created, let's introduce them to each other.
//
this.controls.grid.attachAccessories( this.controls.pageindicator, this.controls.metadata );
},




fetchData: function(fetchParams, callback) {
var u = new URL();
var page = fetchParams.page;
var itemsPerPage = fetchParams.per_page;
u.location = 'http://www.xxx.com/yyy/zzz?page='+ page +'&count='+ itemsPerPage +'&fmt=simplejson';
u.fetchAsync(function(u) {
if ( u.response == 200 ) {
var my_data_struct = JSON.parse(u.result);
my_pager.onGotPage(fetchParams, my_data_struct.results, my_data_struct.total);
var imageArr = [];
var my_data_struct = JSON.parse(u.result);
var totalCount = my_data_struct.feed.totalResults;
var images = my_data_struct.feed.entry;
for (var i in images){
var attr = [];
var item = images[i];
attr.push(item.links[2].mediaGroup[0].thumbnail[0].url);
attr.push(item.title);
attr.push(item.published);
attr.push(item.links[2].mediaGroup[0].content[0].height);
attr.push(item.links[2].mediaGroup[0].content[0].width);
imageArr.push(attr);
}
if(this.controls.grid) {
function images(i) {return i}
this.cache.imgData = imageArr.slice(0).map(function(src,i){return{src:src[0],title:src[1],create:src[2],height:src[3],width:src[4],label:src[1]}});
this.controls.grid.pager.onGotPage(fetchParams, this.cache.imgData, totalDatasetSize);
}
}
});
},


updateView: function (){
this.controls.grid.changeDataset([], true);
},

//
// cell create/update methods get fired in context of grid
//
imageCellCreator: function () {
return new KONtx.control.PhotoGridCell({
styles: this.getCellDimensions(),
events: {
// this onSelect fires in context of cell
onSelect: function (event){
var dataItemNumber = this.getCellDataIndex() + 1;
var dataItemData = this.getCellDataItem();
log ("height: " + dataItemData.height);
log ("width: " + dataItemData.width);
var imageRef = dataItemData.src;
imageRef = imageRef.replace(/thumbnail/, "photos");
imageRef = imageRef.replace(/\?th=77\&tw=77\&s=true/g, "");
KONtx.application.loadView('view-Image',
{
imageURL: imageRef,
imageTitle: dataItemData.title,
createDate: dataItemData.create,
height: dataItemData.height,
width: dataItemData.width
},false);


}
}
});
},

imageCellUpdater: function (cell, dataitem) {
cell.setSources(dataitem);

}
});

by
11 Replies
  • Out of curiosity, try removing the following line from createView:

    this.controls = {};
    0
  • QUOTE (Steve @ Mar 16 2010, 07:03 AM) <{POST_SNAPBACK}>
    Out of curiosity, try removing the following line from createView:

    this.controls = {};



    Didnt change anything



    Ok following my earlier post - I have made some changed, this time no errors are being reported at all - however no images are appearing in the grid.

    I have verified that the url I am using is valid and according to the log it is hitting the correct url, however its not hitting any items that I am logging in the handleFetchResponse

    Any ideas?

    CODE
    /**
    * @author pkelly
    */

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

    Extends: KONtx.system.SidebarView,

    config: {
    rows: 3,
    columns: 3
    },
    initialize: function() {
    this.parent();

    },




    createView: function (){

    var __baseID = (this.id||this.ClassName||this._ktxID+'.ImageGrid');

    this.controls = {};
    var pageSize = 9;
    var fetchSize = 20;
    var howMany = 5;
    var fetchParams = {'page':1, 'per_page':9};
    var my_pager = new KONtx.utility.Pager(pageSize, fetchSize, this.getData(fetchParams, this.handleFetchResponse.bindTo(this)), this, howMany);
    my_pager.initItems(this.cache.imgData,this.totalCount);
    this.controls.headerText = new KONtx.element.Text({
    label: "My Recent Photos",
    wrap: true,
    truncation: 'end',
    styles: {
    fontSize: '20px',
    color: '#FFFFFF',
    textAlign: 'left',
    width: this.width,
    height: 36,
    hOffset: 5
    }
    }).appendTo(this);

    //
    // if this seems goofy, it's because we need to create the page
    // indicator and metadata container first so we can measure their
    // height and fit the grid in last.
    //
    this.controls.pageindicator = new KONtx.control.PageIndicator({
    id: __baseID+'.PageIndicator',
    styles: {
    vAlign: 'bottom',
    vOffset: this.height
    }
    }).appendTo(this);

    this.controls.metadata = new KONtx.control.MetadataDisplay({
    id: __baseID+'.Metadata',
    styles: {
    height: 23,
    vAlign: 'bottom',
    vOffset: this.height - this.controls.pageindicator.height
    }
    }).appendTo(this);

    this.controls.grid = new KONtx.control.Grid({
    id: __baseID+'.Grid',
    pager:my_pager,
    rows: this.config.rows,
    columns: this.config.columns,
    styles: {
    width: this.width,
    height: this.height -
    this.controls.headerText.height -
    this.controls.pageindicator.height -
    this.controls.metadata.height,
    vOffset: this.controls.headerText.height
    },
    cellCreator: this.imageCellCreator,
    cellUpdater: this.imageCellUpdater
    }).appendTo(this);

    //
    // and now that everyone's created, let's introduce them to each other.
    //
    this.controls.grid.attachAccessories( this.controls.pageindicator, this.controls.metadata );
    },

    getData: function(fetchParams, callback) {
    var page = fetchParams.page;
    var itemsPerPage = fetchParams.per_page;
    var u = new URL();
    u.location = 'http://www.abc.com/def/ghi='+ page +'&count='+ itemsPerPage +'&fmt=simplejson';
    log("url: " + u.location);
    },

    handleFetchResponse: function(u) {
    log("response: " + u.response);
    var imageArr = [];
    var my_data_struct = JSON.parse(u.result);
    log("this that: " + my_data_struct);
    var totalCount = my_data_struct.feed.totalResults;
    log("all images: " + totalCount);
    var images = my_data_struct.feed.entry;
    for (var i in images){
    var attr = [];
    var item = images[i];
    attr.push(item.links[2].mediaGroup[0].thumbnail[0].url);
    attr.push(item.title);
    attr.push(item.published);
    attr.push(item.links[2].mediaGroup[0].content[0].height);
    attr.push(item.links[2].mediaGroup[0].content[0].width);
    imageArr.push(attr);
    }
    if(this.controls.grid) {
    function images(i) {return i}
    this.cache.imgData = imageArr.slice(0).map(function(src,i){return{src:src[0],title:src[1],create:src[2],height:src[3],width:src[4],label:src[1]}});
    this.controls.grid.pager.onGotPage(fetchParams, this.cache.imgData, totalCount);
    }

    },

    updateView: function (){
    this.controls.grid.changeDataset([], true);
    },

    //
    // cell create/update methods get fired in context of grid
    //
    imageCellCreator: function () {
    return new KONtx.control.PhotoGridCell({
    styles: this.getCellDimensions(),
    events: {
    // this onSelect fires in context of cell
    onSelect: function (event){
    var dataItemNumber = this.getCellDataIndex() + 1;
    var dataItemData = this.getCellDataItem();
    log ("height: " + dataItemData.height);
    log ("width: " + dataItemData.width);
    var imageRef = dataItemData.src;
    imageRef = imageRef.replace(/thumbnail/, "photos");
    imageRef = imageRef.replace(/\?th=77\&tw=77\&s=true/g, "");
    KONtx.application.loadView('view-Image',
    {
    imageURL: imageRef,
    imageTitle: dataItemData.title,
    createDate: dataItemData.create,
    height: dataItemData.height,
    width: dataItemData.width
    },false);


    }
    }
    });
    },

    imageCellUpdater: function (cell, dataitem) {
    cell.setSources(dataitem);

    }
    });
    0
  • I have verified that the url I am using is valid and according to the log it is hitting the correct url, however its not hitting any items that I am logging in the handleFetchResponse nor is it populating my grid

    Any ideas?

    CODE
    /**
    * @author pkelly
    */

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

    Extends: KONtx.system.SidebarView,

    config: {
    rows: 3,
    columns: 3
    },
    initialize: function() {
    this.parent();

    },




    createView: function (){

    var __baseID = (this.id||this.ClassName||this._ktxID+'.ImageGrid');

    this.controls = {};
    var pageSize = 9;
    var fetchSize = 20;
    var howMany = 5;
    var fetchParams = {'page':1, 'per_page':9};
    var my_pager = new KONtx.utility.Pager(pageSize, fetchSize, this.getData(fetchParams, this.handleFetchResponse.bindTo(this)), this, howMany);
    my_pager.initItems(this.cache.imgData,this.totalCount);
    this.controls.headerText = new KONtx.element.Text({
    label: "My Recent Photos",
    wrap: true,
    truncation: 'end',
    styles: {
    fontSize: '20px',
    color: '#FFFFFF',
    textAlign: 'left',
    width: this.width,
    height: 36,
    hOffset: 5
    }
    }).appendTo(this);

    //
    // if this seems goofy, it's because we need to create the page
    // indicator and metadata container first so we can measure their
    // height and fit the grid in last.
    //
    this.controls.pageindicator = new KONtx.control.PageIndicator({
    id: __baseID+'.PageIndicator',
    styles: {
    vAlign: 'bottom',
    vOffset: this.height
    }
    }).appendTo(this);

    this.controls.metadata = new KONtx.control.MetadataDisplay({
    id: __baseID+'.Metadata',
    styles: {
    height: 23,
    vAlign: 'bottom',
    vOffset: this.height - this.controls.pageindicator.height
    }
    }).appendTo(this);

    this.controls.grid = new KONtx.control.Grid({
    id: __baseID+'.Grid',
    pager:my_pager,
    rows: this.config.rows,
    columns: this.config.columns,
    styles: {
    width: this.width,
    height: this.height -
    this.controls.headerText.height -
    this.controls.pageindicator.height -
    this.controls.metadata.height,
    vOffset: this.controls.headerText.height
    },
    cellCreator: this.imageCellCreator,
    cellUpdater: this.imageCellUpdater
    }).appendTo(this);

    //
    // and now that everyone's created, let's introduce them to each other.
    //
    this.controls.grid.attachAccessories( this.controls.pageindicator, this.controls.metadata );
    },

    getData: function(fetchParams, callback) {
    var page = fetchParams.page;
    var itemsPerPage = fetchParams.per_page;
    var u = new URL();
    u.location = 'http://www.abc.com/def/ghi='+ page +'&count='+ itemsPerPage +'&fmt=simplejson';
    log("url: " + u.location);
    },

    handleFetchResponse: function(u) {
    log("response: " + u.response);
    var imageArr = [];
    var my_data_struct = JSON.parse(u.result);
    log("this that: " + my_data_struct);
    var totalCount = my_data_struct.feed.totalResults;
    log("all images: " + totalCount);
    var images = my_data_struct.feed.entry;
    for (var i in images){
    var attr = [];
    var item = images[i];
    attr.push(item.links[2].mediaGroup[0].thumbnail[0].url);
    attr.push(item.title);
    attr.push(item.published);
    attr.push(item.links[2].mediaGroup[0].content[0].height);
    attr.push(item.links[2].mediaGroup[0].content[0].width);
    imageArr.push(attr);
    }
    if(this.controls.grid) {
    function images(i) {return i}
    this.cache.imgData = imageArr.slice(0).map(function(src,i){return{src:src[0],title:src[1],create:src[2],height:src[3],width:src[4],label:src[1]}});
    this.controls.grid.pager.onGotPage(fetchParams, this.cache.imgData, totalCount);
    }

    },

    updateView: function (){
    this.controls.grid.changeDataset([], true);
    },

    //
    // cell create/update methods get fired in context of grid
    //
    imageCellCreator: function () {
    return new KONtx.control.PhotoGridCell({
    styles: this.getCellDimensions(),
    events: {
    // this onSelect fires in context of cell
    onSelect: function (event){
    var dataItemNumber = this.getCellDataIndex() + 1;
    var dataItemData = this.getCellDataItem();
    log ("height: " + dataItemData.height);
    log ("width: " + dataItemData.width);
    var imageRef = dataItemData.src;
    imageRef = imageRef.replace(/thumbnail/, "photos");
    imageRef = imageRef.replace(/\?th=77\&tw=77\&s=true/g, "");
    KONtx.application.loadView('view-Image',
    {
    imageURL: imageRef,
    imageTitle: dataItemData.title,
    createDate: dataItemData.create,
    height: dataItemData.height,
    width: dataItemData.width
    },false);


    }
    }
    });
    },

    imageCellUpdater: function (cell, dataitem) {
    cell.setSources(dataitem);

    }
    });
    0
  • Ok been banging my head against this for nearly a week now, and unfortunately I am no closer to a resolution

    Below is my current full code - I am seeing no errors in my log file at all, however nor am I seeing any of the log item from fetchData - could someone cast an eye over my code, and even point out where I am going wrong, as this is proving very frustrating for me

    CODE
    /**
    * @author pkelly
    */

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

    Extends: KONtx.system.SidebarView,

    config: {
    rows: 3,
    columns: 3
    },
    initialize: function() {
    this.parent();
    },




    createView: function (){
    var __baseID = (this.id||this.ClassName||this._ktxID+'.ImageGrid');

    var fetchParams = {'page':0, 'per_page':9};

    this.controls = {};

    this.controls.headerText = new KONtx.element.Text({
    label: "My Recent Photos",
    wrap: true,
    truncation: 'end',
    styles: {
    fontSize: '20px',
    color: '#FFFFFF',
    textAlign: 'left',
    width: this.width,
    height: 36,
    hOffset: 5
    }
    }).appendTo(this);

    //
    // if this seems goofy, it's because we need to create the page
    // indicator and metadata container first so we can measure their
    // height and fit the grid in last.
    //
    this.controls.pageindicator = new KONtx.control.PageIndicator({
    styles: {
    vAlign: 'bottom',
    vOffset: this.height
    }
    }).appendTo(this);

    this.controls.metadata = new KONtx.control.MetadataDisplay({
    styles: {
    height: 23,
    vAlign: 'bottom',
    vOffset: this.height - this.controls.pageindicator.height
    }
    }).appendTo(this);

    this.pager = new KONtx.utility.Pager(3*3, 3*3*8, this.fetchData, this, 8);

    this.controls.grid = new KONtx.control.Grid({
    pager: this.pager,
    rows: this.config.rows,
    columns: this.config.columns,
    styles: {
    width: this.width,
    height: this.height -
    this.controls.headerText.height -
    this.controls.pageindicator.height -
    this.controls.metadata.height,
    vOffset: this.controls.headerText.height
    },
    cellCreator: this.imageCellCreator,
    cellUpdater: this.imageCellUpdater
    }).appendTo(this);

    //
    // and now that everyone's created, let's introduce them to each other.
    //
    this.controls.grid.attachAccessories( this.controls.pageindicator, this.controls.metadata );

    },

    updateView: function (){
    //this.controls.photoGrid.changeDataset(this.fetchData, true);
    //this.mygrid.changeDataset([], true);
    this.controls.grid.changeDataset([], true);
    },
    fetchData: function(fetchParams) {
    _log("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM");
    var u = new URL();
    var page = fetchParams.page+1;
    log("page number" + page);
    var itemsPerPage = fetchParams.per_page;
    u.location = 'http://www.xys.com?page='+ page +'&count='+ itemsPerPage +'&fmt=simplejson';
    log("full url is: " + u.location);
    u.fetchAsync(function(u) {
    if (u.response == 200 ) {
    var self = this;
    var imageArr = [];
    var my_data_struct = JSON.parse(u.result);
    var totalCount = my_data_struct.feed.totalResults;
    var images = my_data_struct.feed.entry;
    for (var i in images){
    var attr = [];
    var item = images[i];
    attr.push(item.links[2].mediaGroup[0].thumbnail[0].url);
    attr.push(item.title);
    attr.push(item.published);
    attr.push(item.links[2].mediaGroup[0].content[0].height);
    attr.push(item.links[2].mediaGroup[0].content[0].width);
    imageArr.push(attr);
    }
    var imgData = imageArr.slice(0).map(function(src,i){return{src:src[0],title:src[1],create:src[2],height:src[3],width:src[4],label:src[1]}});
    this.pager.onGotPage(this.fetchParams, imgData, totalCount);

    }
    });
    },
    //
    // cell create/update methods get fired in context of grid
    //
    imageCellCreator: function () {
    return new KONtx.control.PhotoGridCell({
    styles: this.getCellDimensions(),
    events: {
    // this onSelect fires in context of cell
    onSelect: function (event){
    var dataItemNumber = this.getCellDataIndex() + 1;
    var dataItemData = this.getCellDataItem();
    log ("height: " + dataItemData.height);
    log ("width: " + dataItemData.width);
    var imageRef = dataItemData.src;
    imageRef = imageRef.replace(/thumbnail/, "photos");
    imageRef = imageRef.replace(/\?th=77\&tw=77\&s=true/g, "");
    KONtx.application.loadView('view-Image',
    {
    imageURL: imageRef,
    imageTitle: dataItemData.title,
    createDate: dataItemData.create,
    height: dataItemData.height,
    width: dataItemData.width
    },false);


    }
    }
    });
    },

    imageCellUpdater: function (cell, dataitem) {
    cell.setSources(dataitem);

    }
    });
    0
  • ok made a minor update to my code

    CODE
    this.pager = new KONtx.utility.Pager(3*3, 3*3*8, this.fetchData(fetchParams), this, 8);



    its now getting the log information in fetchData - however, I am now seeing an error in my log file relating to

    CODE
    this.pager.onGotPage(this.fetchParams, imgData, totalCount);


    The log file is saying TypeError: this.pager has no properties

    Any ideas what could be causing this error?
    0
  • QUOTE (ph3n0m @ Mar 25 2010, 07:05 AM) <{POST_SNAPBACK}>
    The log file is saying TypeError: this.pager has no properties

    Any ideas what could be causing this error?


    You need to bind the the scope of your class to the URL's callback. Right now, the keyword 'this' is still referring to the instance of the URL type that you created. You need it to reference your class, which has the pager bound to it. Try this:

    CODE
    u.fetchAsync(function(u) {

    ...snipped for brevity...

    }.bindTo(this));


    There are plenty of posts in the forum about scoping.

    - Ben
    0
  • Merged topics.

    ph3n0m, please do not create multiple topics about the same issue in different forums.

    - Ben
    0
  • Apologies for that.

    I have included more updated code below and am now seeing a new problem

    When I load my widget, nothing in the grid is displayed, however when I load/reload it a few times, the grid is populated, but only by the first few images, and the paging still only shows "page 1 of 1".

    again I ask, does anyone have any ideas why this is happening on the simulator

    CODE
    /**
    * @author pkelly
    */

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

    Extends: KONtx.system.SidebarView,

    config: {
    rows: 3,
    columns: 3
    },
    initialize: function () {
    this.parent();
    },
    createView: function () {


    var fetchParams = {
    'page': 1,
    'per_page': 9
    };

    this.controls = {};

    this.controls.headerText = new KONtx.element.Text({
    label: "My Recent Photos",
    wrap: true,
    truncation: 'end',
    styles: {
    fontSize: '20px',
    color: '#FFFFFF',
    textAlign: 'left',
    width: this.width,
    height: 36,
    hOffset: 5
    }
    }).appendTo(this);

    //
    // if this seems goofy, it's because we need to create the page
    // indicator and metadata container first so we can measure their
    // height and fit the grid in last.
    //
    this.controls.pageindicator = new KONtx.control.PageIndicator({
    styles: {
    vAlign: 'bottom',
    vOffset: this.height
    }
    }).appendTo(this);

    this.controls.metadata = new KONtx.control.MetadataDisplay({
    styles: {
    height: 23,
    vAlign: 'bottom',
    vOffset: this.height - this.controls.pageindicator.height
    }
    }).appendTo(this);

    this.controls.pager = new KONtx.utility.Pager(3 * 3, 3 * 3 * 8, this.fetchData(fetchParams), this, 1);
    this.controls.grid = new KONtx.control.Grid({
    pager: this.controls.pager,
    rows: this.config.rows,
    columns: this.config.columns,
    styles: {
    width: this.width,
    height: this.height - this.controls.headerText.height - this.controls.pageindicator.height - this.controls.metadata.height,
    vOffset: this.controls.headerText.height
    },
    cellCreator: this.imageCellCreator,
    cellUpdater: this.imageCellUpdater
    }).appendTo(this);

    //
    // and now that everyone's created, let's introduce them to each other.
    //
    this.controls.grid.attachAccessories(this.controls.pageindicator, this.controls.metadata);

    },

    updateView: function () {
    //this.controls.grid.changeDataset(this.cache.imgData);
    this.controls.grid.changeDataset(this.cache.imgData, true);
    },
    fetchData: function (fetchParams) {
    log("MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM");
    var u = new URL();
    var page = fetchParams.page;
    log("page number" + page);
    var itemsPerPage = fetchParams.per_page;
    u.location = 'http://www.xyz.com?page=' + page + '&count=' + itemsPerPage + '&fmt=simplejson';
    log("full url is: " + u.location);
    u.fetchAsync(function (u) {
    log("CONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNECTING");
    if (u.response == 200) {
    log("COOOOOOOOOOOOOOOOOOOOOOONNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNECCCCCCCCCCCCCCCC
    CCCCCCTED");
    var self = this;
    var imageArr = [];
    var my_data_struct = JSON.parse(u.result);
    var totalCount = my_data_struct.feed.totalResults;
    var images = my_data_struct.feed.entry;
    for (var i in images) {
    var attr = [];
    var item = images[i];
    attr.push(item.links[2].mediaGroup[0].thumbnail[0].url);
    attr.push(item.title);
    attr.push(item.published);
    attr.push(item.links[2].mediaGroup[0].content[0].height);
    attr.push(item.links[2].mediaGroup[0].content[0].width);
    imageArr.push(attr);
    }
    this.cache.imgData = imageArr.slice(0).map(function (src, i) {
    return {
    src: src[0],
    title: src[1],
    create: src[2],
    height: src[3],
    width: src[4],
    label: src[1]
    };
    });
    log("IMMMMMMMMMAGEEEEEEEEEEEEEEEEEEE DATA" + this.cache.imgData);
    fetchParams = {
    'page': page+1,
    'per_page': 9
    };
    log("new page" + fetchParams.page);
    log("per page" + fetchParams.per_page);
    this.controls.pager.onGotPage(fetchParams, this.cache.imgData, totalCount);


    }
    }.bindTo(this));
    },
    //
    // cell create/update methods get fired in context of grid
    //
    imageCellCreator: function () {
    return new KONtx.control.PhotoGridCell({
    styles: this.getCellDimensions(),
    events: {
    // this onSelect fires in context of cell
    onSelect: function (event) {
    var dataItemNumber = this.getCellDataIndex() + 1;
    var dataItemData = this.getCellDataItem();
    log("height: " + dataItemData.height);
    log("width: " + dataItemData.width);
    var imageRef = dataItemData.src;
    imageRef = imageRef.replace(/thumbnail/, "photos");
    imageRef = imageRef.replace(/\?th=77\&tw=77\&s=true/g, "");
    KONtx.application.loadView('view-Image', {
    imageURL: imageRef,
    imageTitle: dataItemData.title,
    createDate: dataItemData.create,
    height: dataItemData.height,
    width: dataItemData.width
    }, false);


    }
    }
    });
    },

    imageCellUpdater: function (cell, dataitem) {
    cell.setSources(dataitem);

    }
    });
    0
  • apologies for bumping this, but I am up against a wall with this pagination stuff - all the items I am logging are viewable, however the grid isnt showing any items, nor is the pagination correct - still showing only page 1 of 1, even if I have over 80 items in my JSON feed
    0
  • QUOTE (ph3n0m @ Apr 12 2010, 02:14 AM) <{POST_SNAPBACK}>
    apologies for bumping this, but I am up against a wall with this pagination stuff - all the items I am logging are viewable, however the grid isnt showing any items, nor is the pagination correct - still showing only page 1 of 1, even if I have over 80 items in my JSON feed

    Sorry for the delay in getting to this. We're aware of your issue and allocate resources as we can, though we realize sometimes it's not as quickly as we'd like. As soon as some time frees up I'll personally look into this. We're a small team, and unfortunately we don't have anyone dedicated to answering forum questions full-time.

    - Ben
    0
  • QUOTE (Benjamin Toll @ Apr 12 2010, 10:48 AM) <{POST_SNAPBACK}>
    Sorry for the delay in getting to this. We're aware of your issue and allocate resources as we can, though we realize sometimes it's not as quickly as we'd like. As soon as some time frees up I'll personally look into this. We're a small team, and unfortunately we don't have anyone dedicated to answering forum questions full-time.

    - Ben



    Ben

    Appreciate that, I know full well the "joys" of working on a small team ;)And again, thanks for all the previous help
    0

Recent Posts

in General - Yahoo! TV Widgets