},
});
+FilteredCompositeView = Marionette.CompositeView.extend( {
+ showCollection: function() {
+ var ChildView;
+ this.collection.each(function(child, index) {
+ filterFunc = this.options.filter || this.filter;
+ if (filterFunc && !filterFunc(child)) {
+ return;
+ }
+ ChildView = this.getChildView(child);
+ this.addChild(child, ChildView, index);
+ }, this);
+
+ },
+});
+
SliceSelectorOption = Marionette.ItemView.extend({
template: "#xos-sliceselector-option",
tagName: "option",
},
});
-SliceSelectorView = Marionette.CompositeView.extend({
+SliceSelectorView = FilteredCompositeView.extend({
template: "#xos-sliceselector-select",
childViewContainer: "select",
childView: SliceSelectorOption,
templateHelpers: function() { return {caption: this.options.caption || this.caption }; },
});
-FilteredCompositeView = Marionette.CompositeView.extend( {
- showCollection: function() {
- var ChildView;
- this.collection.each(function(child, index) {
- if (this.filter && !this.filter(child)) {
- return;
- }
- ChildView = this.getChildView(child);
- this.addChild(child, ChildView, index);
- }, this);
-
- },
-});
-
XOSRouter = Marionette.AppRouter.extend({
initialize: function() {\r
this.routeStack=[];\r
*/
initialize: function() {
- this.on("saveSuccess", this.onAfterSave);
+ this.on("saveSuccess", this.onSaveSuccess);
this.synchronous = false;
},
});
},
+ saveSuccess: function(e) {
+ // always called after a save succeeds
+ },
+
afterSave: function(e) {
+ // if this.synchronous, then called after the save succeeds
+ // if !this.synchronous, then called after save is initiated
},
- onAfterSave: function(e) {
- this.afterSave(e);
+ onSaveSuccess: function(e) {
+ this.saveSuccess(e);
+ if (this.synchronous) {
+ this.afterSave(e);
+ }
},
inputChanged: function(e) {
this.model.save(data, {error: function(model, result, xhr) { that.app.saveError(model,result,xhr,infoMsgId);},
success: function(model, result, xhr) { that.app.saveSuccess(model,result,xhr,infoMsgId);
- if (that.synchronous) {
- that.trigger("saveSuccess");
- }
+ that.trigger("saveSuccess");
}});
this.dirty = false;
model: this.model,
detailView: this,
choices: this.options.choices || this.choices || this.model.choices || {},
+ helpText: this.options.helpText || this.helpText || this.model.helpText || {},
}},
});
render: function() {
var view = this;
+ var fieldDisplayNames = view.options.fieldDisplayNames || view.fieldDisplayNames || {};
view.columnsByIndex = [];
view.columnsByFieldName = {};
inputType = view.options.inputType || view.inputType || {};
mRender = undefined;
mSearchText = undefined;
- sTitle = fieldNameToHumanReadable(fieldName);
+ sTitle = fieldName in fieldDisplayNames ? fieldDisplayNames[fieldName] : fieldNameToHumanReadable(fieldName);
bSortable = true;
if (fieldName=="backend_status") {
mRender = function(x,y,z) { return xosBackendStatusIconTemplate(z); };
aaData.sort(function(a,b) { return compareColumns(sortCols, sortDirs, a, b); });\r
\r
// slice it for pagination\r
- aaData = aaData.slice(iDisplayStart, iDisplayStart+iDisplayLength);\r
+ if (iDisplayLength >= 0) {\r
+ aaData = aaData.slice(iDisplayStart, iDisplayStart+iDisplayLength);\r
+ }\r
\r
return fnCallback({iTotalRecords: totalSize,\r
iTotalDisplayRecords: filteredSize,\r