git-svn-id: https://msi/svn/firstRepo/WebClient/branches/Manut_2.2.3@29 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryItemModel'],
|
||||
function (app, $, _, Backbone, Category){
|
||||
define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/searchItemModel'],
|
||||
function (app, $, _, Backbone, SearchItem){
|
||||
|
||||
var FoundItems=Backbone.Collection.extend({
|
||||
dataFilter: null,
|
||||
numItems: null,
|
||||
indexItems: null,
|
||||
totalRecords: 0,
|
||||
initialize: function (options) {
|
||||
this.dataFilter = {
|
||||
titolo: options.titolo,
|
||||
@@ -10,14 +13,24 @@ define(['app', 'jquery', 'underscore', 'backbone', 'model/categoryItem/categoryI
|
||||
categoryId: options.categoryId
|
||||
};
|
||||
this.numItems = options.nResult;
|
||||
this.indexItems = options.indexItems;
|
||||
},
|
||||
|
||||
parse: function(data){
|
||||
this.totalRecords = data["0"].TotalRecords;
|
||||
return data.records;
|
||||
},
|
||||
// Book is the model of the collection
|
||||
model:SearchItem,
|
||||
|
||||
getTotalRecords: function(){
|
||||
return this.totalRecords;
|
||||
},
|
||||
|
||||
|
||||
// Book is the model of the collection
|
||||
model:Category,
|
||||
|
||||
url: function() {
|
||||
var u = myManifest.Settings.DefaultURL + "/api/categoryitems/search/" + this.numItems +
|
||||
var u = myManifest.Settings.DefaultURL + "/api/categoryitems/search/" +
|
||||
this.numItems +
|
||||
"/" + this.indexItems +
|
||||
"/" + this.dataFilter.categoryId +
|
||||
"/" + this.dataFilter.difficolta;
|
||||
if(this.dataFilter.titolo !== null)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
define(['jquery', 'underscore', 'backbone'],
|
||||
function ($, _, Backbone){
|
||||
|
||||
var SearchItem = Backbone.Model.extend({
|
||||
//default attributes
|
||||
defaults: {
|
||||
ricetta_id: "",
|
||||
titolo: '',
|
||||
autore: '',
|
||||
valutazione: 0,
|
||||
difficolta: 0,
|
||||
categoria_name: 0
|
||||
}
|
||||
});
|
||||
|
||||
return SearchItem;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user