git-svn-id: https://msi/svn/firstRepo/WebClient/branches/Manut_2.2.3@29 0f545695-f87b-41b6-9a03-7f16563b5454

This commit is contained in:
2015-02-01 22:28:34 +00:00
parent 12bfd218c2
commit 6ce1700ef4
20 changed files with 338 additions and 265 deletions
+41 -1
View File
@@ -12,22 +12,62 @@ define(['jquery', 'underscore', 'backbone','text!modules/search/foundViewTemplat
var self = this;
FoundView.__super__.initialize.call(this);
this.collection = options.collection;
this.collection.fetch({
success: function(){ self.renderItem(); } });
},
events: {
"click #pagSucc": "nextPageSearch",
"click #pagPrec": "prevPageSearch"
},
goTop: function(element) {
$('html, body').animate({
scrollTop: '0px'
}, 'fast');
return element; // for chaining...
},
renderItem: function(){
var $ul = $('#foundRicette');
$ul.html('');
var items = this.itemTemplate({data:this.collection.toJSON()});
$ul.html( items );
$ul.listview( "refresh" );
$ul.trigger( "updatelayout");
if(this.collection.indexItems === 0)
$('#pagPrec').hide();
else
$('#pagPrec').show();
if(this.collection.getTotalRecords() < (this.collection.indexItems + 1) * this.collection.numItems)
$('#pagSucc').hide();
else
$('#pagSucc').show();
$.mobile.loading( 'hide' );
//$( '[data-alpha="true"]' ).alphascroll();
},
nextPageSearch: function(e){
e.preventDefault();
var self=this;
this.collection.indexItems++;
this.collection.fetch({reset: true,
success: function(){ self.renderItem(); } });
this.goTop();
},
prevPageSearch: function(e){
e.preventDefault();
var self=this;
this.collection.indexItems--;
this.collection.fetch({reset: true,
success: function(){ self.renderItem(); } });
},
//render the content into div of view
render: function(){
+4 -3
View File
@@ -1,5 +1,6 @@
<div id="categoryListContent" data-role="content">
<h1>Ricerca Ricette...</h1>
<ul id="foundRicette" data-role="listview" data-autodividers="true" data-inset="true">
</ul>
<h1>Ricerca Ricette...</h1>
<center><a href="" id="pagPrec" button="true" class="ui-btn ui-corner-all">Pagina precedente</a></center>
<ul id="foundRicette" data-role="listview" data-autodividers="true" data-inset="true"></ul>
<center><a href="" id="pagSucc" button="true" class="ui-btn ui-corner-all">Pagina successiva</a></center>
</div>