git-svn-id: https://msi/svn/firstRepo/Management/trunk@49 0f545695-f87b-41b6-9a03-7f16563b5454
This commit is contained in:
+107
-101
@@ -6,7 +6,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/ricette/ricetteViewTem
|
||||
dataAdapter: undefined,
|
||||
//initialize template
|
||||
template: _.template(ricetteViewTemplate),
|
||||
|
||||
window:null,
|
||||
editorRicetta: null,
|
||||
|
||||
initialize: function() {
|
||||
@@ -19,7 +19,7 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/ricette/ricetteViewTem
|
||||
if (event.args) {
|
||||
var item = event.args.item;
|
||||
if (item) {
|
||||
self.dataAdapter._source.url = myManifest.Settings.DefaultURL + "/backend/categoryitems/" + item.value;
|
||||
self.dataAdapter._source.url = myManifest.Settings.DefaultURL + "/backend/ricette/" + item.value;
|
||||
self.dataAdapter.dataBind();
|
||||
$("#jqxgrid").jqxGrid('updatebounddata');
|
||||
}
|
||||
@@ -35,112 +35,118 @@ define(['jquery', 'underscore', 'backbone', 'text!modules/ricette/ricetteViewTem
|
||||
//this.header.title = "pippo";
|
||||
RicetteView.__super__.render.call(this);
|
||||
var self = this;
|
||||
var window = new Window({
|
||||
title: "Ricette",
|
||||
width: "850px",
|
||||
resizable: true,
|
||||
height: "510px",
|
||||
maxHeight: 1000,
|
||||
maxWidth: 1000,
|
||||
content: "<p><div id=\"categoriaCmb\"></div></p>\n\
|
||||
<p><div id=\"jqxgrid\"></div></p>",
|
||||
initContentFn: function() {
|
||||
var source =
|
||||
{
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'category_id'},
|
||||
{name: 'name'}
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/backend/categories",
|
||||
data: {
|
||||
}
|
||||
};
|
||||
var dataAdapter = new $.jqx.dataAdapter(source);
|
||||
$("#categoriaCmb").jqxDropDownList(
|
||||
{
|
||||
width: 200,
|
||||
height: 25,
|
||||
source: dataAdapter,
|
||||
selectedIndex: 0,
|
||||
displayMember: "name",
|
||||
valueMember: "category_id"
|
||||
});
|
||||
|
||||
$("#categoriaCmb").on('select', {scope: self}, self.fillGrid);
|
||||
if(self.window === null)
|
||||
{
|
||||
self.window = new Window({
|
||||
id: "ricette",
|
||||
title: "Ricette",
|
||||
width: "850px",
|
||||
resizable: true,
|
||||
height: "510px",
|
||||
maxHeight: 1000,
|
||||
maxWidth: 1000,
|
||||
content: "<p><div id=\"categoriaCmb\"></div></p>\n\
|
||||
<p><div id=\"jqxgrid\"></div></p>",
|
||||
initContentFn: function() {
|
||||
var source =
|
||||
{
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'category_id'},
|
||||
{name: 'name'}
|
||||
],
|
||||
url: myManifest.Settings.DefaultURL + "/backend/categories",
|
||||
data: {
|
||||
}
|
||||
};
|
||||
var dataAdapter = new $.jqx.dataAdapter(source);
|
||||
$("#categoriaCmb").jqxDropDownList(
|
||||
{
|
||||
width: 200,
|
||||
height: 25,
|
||||
source: dataAdapter,
|
||||
selectedIndex: 0,
|
||||
displayMember: "name",
|
||||
valueMember: "category_id"
|
||||
});
|
||||
|
||||
// prepare the data
|
||||
self.dataAdapter = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'ricetta_id', type: 'int'},
|
||||
{name: 'titolo', type: 'string'},
|
||||
{name: 'autore', type: 'string'}
|
||||
],
|
||||
id: 'ricetta_id',
|
||||
url: myManifest.Settings.DefaultURL + "/backend/categoryitems/0"
|
||||
});
|
||||
$("#jqxgrid").jqxGrid({
|
||||
width: "100%",
|
||||
height: "87%",
|
||||
source: self.dataAdapter,
|
||||
filterable: true,
|
||||
autoshowfiltericon: true,
|
||||
columns: [
|
||||
{text: 'Titolo', dataField: 'titolo', width: "50%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
{text: 'Autore', dataField: 'autore', width: "30%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Edit', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "Modifica";
|
||||
$("#categoriaCmb").on('select', {scope: self}, self.fillGrid);
|
||||
|
||||
// prepare the data
|
||||
self.dataAdapter = new $.jqx.dataAdapter({
|
||||
datatype: "jsonp",
|
||||
datafields: [
|
||||
{name: 'ricetta_id', type: 'int'},
|
||||
{name: 'titolo', type: 'string'},
|
||||
{name: 'autore', type: 'string'}
|
||||
],
|
||||
id: 'ricetta_id',
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricette/3"
|
||||
});
|
||||
$("#jqxgrid").jqxGrid({
|
||||
width: "100%",
|
||||
height: "87%",
|
||||
source: self.dataAdapter,
|
||||
filterable: true,
|
||||
autoshowfiltericon: true,
|
||||
columns: [
|
||||
{text: 'Titolo', dataField: 'titolo', width: "50%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
self.openRicetta(row);
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Del', columntype: 'button', width: '10%',
|
||||
cellsrenderer: function() {
|
||||
return "Elimina";
|
||||
{text: 'Autore', dataField: 'autore', width: "30%",
|
||||
cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties) {
|
||||
return "<div style='overflow: hidden; text-overflow: ellipsis; padding-bottom: 2px; text-align: left; margin-right: 2px; margin-left: 4px; margin-top: 4px;'>" + unescape(value ) + "</div>";
|
||||
}
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricetta/" + row.id,
|
||||
//dataType: "json",
|
||||
type: 'DELETE'
|
||||
}).then(function (response) {
|
||||
var msg = response;
|
||||
alert(msg.message);
|
||||
});
|
||||
{text: '', datafield: 'Edit', columntype: 'button', width: '10%', filterable: false, sortable: false, menu: false,
|
||||
cellsrenderer: function() {
|
||||
return "Modifica";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
self.openRicetta(row);
|
||||
}
|
||||
},
|
||||
{text: '', datafield: 'Del', columntype: 'button', width: '10%', filterable: false, sortable: false, menu: false,
|
||||
cellsrenderer: function() {
|
||||
return "Elimina";
|
||||
},
|
||||
buttonclick: function(row) {
|
||||
$.ajax({
|
||||
url: myManifest.Settings.DefaultURL + "/backend/ricetta/" + row.id,
|
||||
//dataType: "json",
|
||||
type: 'DELETE'
|
||||
}).then(function (response) {
|
||||
var msg = response;
|
||||
alert(msg.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
]
|
||||
});
|
||||
|
||||
$('#jqxgrid').on('rowdoubleclick', function(event)
|
||||
{
|
||||
var args = event.args;
|
||||
var row = args.rowindex;
|
||||
self.openRicetta(row);
|
||||
});
|
||||
}
|
||||
});
|
||||
window.id = "ricette";
|
||||
$('#jqxgrid').on('rowdoubleclick', function(event)
|
||||
{
|
||||
var args = event.args;
|
||||
var row = args.rowindex;
|
||||
self.openRicetta(row);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.$el.append(this.template());
|
||||
this.$el.find("#content").append(window.$el);
|
||||
window.render();
|
||||
|
||||
this.editorRicetta = new EditRicetta();
|
||||
this.$el.find("#content").append(this.editorRicetta.$el);
|
||||
|
||||
this.editorRicetta.render();
|
||||
this.$el.append(this.template());
|
||||
this.$el.find("#content").append(self.window.$el);
|
||||
self.window.render();
|
||||
|
||||
this.editorRicetta = new EditRicetta();
|
||||
this.$el.find("#content").append(this.editorRicetta.$el);
|
||||
|
||||
this.editorRicetta.render();
|
||||
}
|
||||
else
|
||||
self.window.open();
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user