absolute newbie needs help with a series of images and pagination

Julie1 Sep 2011 9:50 AM
I've looked at the sample widgets and thus far don't see one that does what I need it to do. Here's a rough example of what I need to do on my main view...

[ top of interface with home button and logo]
[ title of section - recent videos ]
[ a large image with arrows left and right ]
[ title of image ]
[ oooooooooooo (pagination dots) ]

I can't figure out how to do this. I think I need a grid and pagination, but can't find an example. Can someone point me in the right direction? So far I just have this:

                 this.controls.pageindicator = new KONtx.control.PageIndicator({
id: "recent_videos.PageIndicator",
styles:{
vAlign: "bottom",
vOffset: "this.height"  
}
}).appendTo(this); 

and that doesn't even show up. Thanks!
buddy22 Sep 2011 9:17 AM
Hey Julie,<br><br>Were you able to get this problem resolved? &nbsp;What you&#39;re proposing seems pretty doable. &nbsp;Depending on your intentions for this widget, you may not even need a grid/pagination. &nbsp;Essentially, if you want to load all the data upfront and allow the user to quickly switch from image to image, a grid may be more up your alley. &nbsp;But if you prefer a nonexistant initial load with small loads on every arrow click, you can skip the grid/pagination entirely. &nbsp;<br><br>Here is some working code from an image grid I am using:<br> --------------------- C O D E ------------------------------------------------------------------------<br>//FIRST, The control. &nbsp;This is init in the createView function<br><div>this.controls.photoGrid = new KONtx.control.Grid({<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;columns: 3,<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;rows: 3,<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;carousel: true,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cellCreator: this._photoCellCreator,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cellUpdater: this._photoCellUpdater,<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;styles: {<span class="Apple-tab-span" style="white-space:pre;"> </span><div><span class="Apple-tab-span" style="white-space:pre;"> </span>height:275,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>//vOffset:this.controls.citySelector_con.outerHeight,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>width: this.width,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>zOrder:2,<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;},<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;manageWaitIndicator: true<div>&nbsp;&nbsp;&nbsp;&nbsp;}).appendTo(this.controls.photo_con);<div><br>//The cellCreator function is called to &quot;build&quot; the grid. &nbsp;First create the cell object then fill it as you would any other control.<br>_photoCellCreator: function() {<div><span class="Apple-tab-span" style="white-space:pre;"> </span>var cell = new KONtx.control.GridCell({<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; styles: {<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height: KONtx.utility.scale(18),<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width: this.width,<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; events: {<div><span class="Apple-tab-span" style="white-space:pre;"> </span>onSelect: function(event) {<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>//store the photo info for the next view. &nbsp;Avoid this.persist which gave issues whn viewing multiple photos<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>photoInfo = {<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>&#39;targetIndex&#39; : this.GRIDINDEX,<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>&#39;targetID&#39; : this.ID,<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>&#39;targetURL&#39; : this.URL,<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>&#39;targetUID&#39; : this.UID, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre;"> </span><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;};<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>photoInfo=JSON.stringify(photoInfo);<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>KONtx.messages.store(&#39;currentPhoto&#39;, photoInfo);<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>KONtx.application.loadView(&#39;view-FullPhoto&#39;);<div><span class="Apple-tab-span" style="white-space:pre;"> </span>}<div><span class="Apple-tab-span" style="white-space:pre;"> </span>}<div>&nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp;&nbsp;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.cell_img = new KONtx.element.Image({<div><span class="Apple-tab-span" style="white-space:pre;"> </span>src:&#39;&#39;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>styles:{<div><span class="Apple-tab-span" style="white-space:pre;"> </span>hAlign:&#39;center&#39;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>vAlign:&#39;center&#39;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>}<div>&nbsp; &nbsp; &nbsp; &nbsp; }).appendTo(cell);<div><span class="Apple-tab-span" style="white-space:pre;"> </span>return cell;<div>&nbsp;&nbsp;&nbsp;&nbsp;},<div>//This is the cellUpdater function. &nbsp;this function is invoked via&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a call tot the grid&#39;s changeDataset function. &nbsp;This will fill each cell with content<div>_photoCellUpdater: function(cell, dataitem) {<br><div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.cell_img.src=dataitem.thumbURL;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.GRIDINDEX=dataitem.gridIndex<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.URL=dataitem.url;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.ID=dataitem.id;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.UID=dataitem.uid;<div>&nbsp; &nbsp; },<div>//This is the code where I build my photo&#39;s dataset and apply it to the grid.<br>//It&#39;s part of a larger function but should show how I took data, built the ARRAY for the gridUpdate and use the changeDataset function<br><br><div>for(var nona in photoData){<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;photo_ar[nona]={<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;id&quot;:photoData[nona].id,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;gridIndex&quot; : nona,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;thumbURL&quot;:photoData[nona].thumbUrl+&#39;/225&#39;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;uid&quot;:photoData[nona].uid,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;url&quot; : photoData[nona].publicUrl+&#39;/15&#39;,//photoData[nona].thumbUrl+&#39;/619&#39;,<div>&nbsp;&nbsp;&nbsp;&nbsp;};<div>}<br>photosData=JSON.stringify(photo_ar);<div>KONtx.messages.store(&#39;photostripData&#39;, photosData);<div>this.self.controls.photoGrid.changeDataset(photo_ar)--------------------- C O D E ------------------------------------------------------------------------<br><br>Sorry &nbsp;for the wall of text. &nbsp;If you haven&#39;t developed a solution, hopefully this will point you in the right direction :)<br><div class="quote "><div class="quotetop ">QUOTE<cite>(Julie @ 1 Sep 2011 9:50 AM)</cite><blockquote class="quotemain">I&#39;ve looked at the sample widgets and thus far don&#39;t see one that does what I need it to do. Here&#39;s a rough example of what I need to do on my main view...<br><br>[ top of interface with home button and logo]<br>[ title of section - recent videos ]<br>[ a large image with arrows left and right ]<br>[ title of image ]<br>[ oooooooooooo (pagination dots) ]<br><br>I can&#39;t figure out how to do this. I think I need a grid and pagination, but can&#39;t find an example. Can someone point me in the right direction? So far I just have this:<br><br><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.controls.pageindicator = new KONtx.control.PageIndicator({<div><span class="Apple-tab-span" style="white-space:pre;"> </span>id: &quot;recent_videos.PageIndicator&quot;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>styles:{<div><span class="Apple-tab-span" style="white-space:pre;"> </span>vAlign: &quot;bottom&quot;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>vOffset: &quot;this.height&quot; &nbsp;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>}<div><span class="Apple-tab-span" style="white-space:pre;"> </span><span class="Apple-tab-span" style="white-space:pre;"> </span>}).appendTo(this);&nbsp;<br><br>and that doesn&#39;t even show up. Thanks!</div></div></div></div></div></div></div></blockquote></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>
buddy22 Sep 2011 9:21 AM
Oops, I forgot one thing. &nbsp;If you are intent on using the pagination control or find it up your alley, you will need to use the&nbsp; attachAccessories&nbsp;command to make it usable:<br><br><div>this.controls.resultsPager = new KONtx.control.PageIndicator({<div>&nbsp; &nbsp; &nbsp; &nbsp; styles: {<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vOffset: this.controls.resultsGrid.outerHeight<div>&nbsp; &nbsp; &nbsp; &nbsp; } &nbsp;<div>}).appendTo(this.controls.results_con);<div>this.controls.resultsGrid.attachAccessories(this.controls.resultsPager);<br><br>Of course, you can continue to control the pager like any other control<br><div class="quote "><div class="quotetop ">QUOTE<cite>(buddy @ 22 Sep 2011 9:17 AM)</cite><blockquote class="quotemain">Hey Julie,<br><br>Were you able to get this problem resolved? &nbsp;What you&#39;re proposing seems pretty doable. &nbsp;Depending on your intentions for this widget, you may not even need a grid/pagination. &nbsp;Essentially, if you want to load all the data upfront and allow the user to quickly switch from image to image, a grid may be more up your alley. &nbsp;But if you prefer a nonexistant initial load with small loads on every arrow click, you can skip the grid/pagination entirely. &nbsp;<br><br>Here is some working code from an image grid I am using:<br> --------------------- C O D E ------------------------------------------------------------------------<br>//FIRST, The control. &nbsp;This is init in the createView function<br><div>this.controls.photoGrid = new KONtx.control.Grid({<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;columns: 3,<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;rows: 3,<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;carousel: true,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cellCreator: this._photoCellCreator,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cellUpdater: this._photoCellUpdater,<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;styles: {<span class="Apple-tab-span" style="white-space:pre;"> </span><div><span class="Apple-tab-span" style="white-space:pre;"> </span>height:275,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>//vOffset:this.controls.citySelector_con.outerHeight,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>width: this.width,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>zOrder:2,<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;},<div>&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;manageWaitIndicator: true<div>&nbsp;&nbsp;&nbsp;&nbsp;}).appendTo(this.controls.photo_con);<div><br>//The cellCreator function is called to &quot;build&quot; the grid. &nbsp;First create the cell object then fill it as you would any other control.<br>_photoCellCreator: function() {<div><span class="Apple-tab-span" style="white-space:pre;"> </span>var cell = new KONtx.control.GridCell({<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; styles: {<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height: KONtx.utility.scale(18),<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width: this.width,<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; },<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; events: {<div><span class="Apple-tab-span" style="white-space:pre;"> </span>onSelect: function(event) {<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>//store the photo info for the next view. &nbsp;Avoid this.persist which gave issues whn viewing multiple photos<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>photoInfo = {<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>&#39;targetIndex&#39; : this.GRIDINDEX,<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>&#39;targetID&#39; : this.ID,<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>&#39;targetURL&#39; : this.URL,<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>&#39;targetUID&#39; : this.UID, &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="Apple-tab-span" style="white-space:pre;"> </span><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;};<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>photoInfo=JSON.stringify(photoInfo);<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>KONtx.messages.store(&#39;currentPhoto&#39;, photoInfo);<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="Apple-tab-span" style="white-space:pre;"> </span>KONtx.application.loadView(&#39;view-FullPhoto&#39;);<div><span class="Apple-tab-span" style="white-space:pre;"> </span>}<div><span class="Apple-tab-span" style="white-space:pre;"> </span>}<div>&nbsp; &nbsp; }); &nbsp; &nbsp; &nbsp;&nbsp;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.cell_img = new KONtx.element.Image({<div><span class="Apple-tab-span" style="white-space:pre;"> </span>src:&#39;&#39;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>styles:{<div><span class="Apple-tab-span" style="white-space:pre;"> </span>hAlign:&#39;center&#39;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>vAlign:&#39;center&#39;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>}<div>&nbsp; &nbsp; &nbsp; &nbsp; }).appendTo(cell);<div><span class="Apple-tab-span" style="white-space:pre;"> </span>return cell;<div>&nbsp;&nbsp;&nbsp;&nbsp;},<div>//This is the cellUpdater function. &nbsp;this function is invoked via&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a call tot the grid&#39;s changeDataset function. &nbsp;This will fill each cell with content<div>_photoCellUpdater: function(cell, dataitem) {<br><div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.cell_img.src=dataitem.thumbURL;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.GRIDINDEX=dataitem.gridIndex<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.URL=dataitem.url;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.ID=dataitem.id;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>cell.UID=dataitem.uid;<div>&nbsp; &nbsp; },<div>//This is the code where I build my photo&#39;s dataset and apply it to the grid.<br>//It&#39;s part of a larger function but should show how I took data, built the ARRAY for the gridUpdate and use the changeDataset function<br><br><div>for(var nona in photoData){<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;photo_ar[nona]={<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;id&quot;:photoData[nona].id,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;gridIndex&quot; : nona,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;thumbURL&quot;:photoData[nona].thumbUrl+&#39;/225&#39;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;uid&quot;:photoData[nona].uid,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>&quot;url&quot; : photoData[nona].publicUrl+&#39;/15&#39;,//photoData[nona].thumbUrl+&#39;/619&#39;,<div>&nbsp;&nbsp;&nbsp;&nbsp;};<div>}<br>photosData=JSON.stringify(photo_ar);<div>KONtx.messages.store(&#39;photostripData&#39;, photosData);<div>this.self.controls.photoGrid.changeDataset(photo_ar)--------------------- C O D E ------------------------------------------------------------------------<br><br>Sorry &nbsp;for the wall of text. &nbsp;If you haven&#39;t developed a solution, hopefully this will point you in the right direction :)<br><div class="quote "><div class="quotetop ">QUOTE<cite>(Julie @ 1 Sep 2011 9:50 AM)</cite><blockquote class="quotemain">I&#39;ve looked at the sample widgets and thus far don&#39;t see one that does what I need it to do. Here&#39;s a rough example of what I need to do on my main view...<br><br>[ top of interface with home button and logo]<br>[ title of section - recent videos ]<br>[ a large image with arrows left and right ]<br>[ title of image ]<br>[ oooooooooooo (pagination dots) ]<br><br>I can&#39;t figure out how to do this. I think I need a grid and pagination, but can&#39;t find an example. Can someone point me in the right direction? So far I just have this:<br><br><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this.controls.pageindicator = new KONtx.control.PageIndicator({<div><span class="Apple-tab-span" style="white-space:pre;"> </span>id: &quot;recent_videos.PageIndicator&quot;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>styles:{<div><span class="Apple-tab-span" style="white-space:pre;"> </span>vAlign: &quot;bottom&quot;,<div><span class="Apple-tab-span" style="white-space:pre;"> </span>vOffset: &quot;this.height&quot; &nbsp;<div><span class="Apple-tab-span" style="white-space:pre;"> </span>}<div><span class="Apple-tab-span" style="white-space:pre;"> </span><span class="Apple-tab-span" style="white-space:pre;"> </span>}).appendTo(this);&nbsp;<br><br>and that doesn&#39;t even show up. Thanks!</div></div></div></div></div></div></div></blockquote></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div></div></div></div></div></div></div></div>