X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetstack%2Fcore%2Fxoslib%2Fstatic%2Fjs%2Fxoslib%2FxosHelper.js;h=76254f6d16605456145fc802addc9c608325b69d;hb=753a13edfd39603fbdc59747c4d7c2b59a2d06b9;hp=b479e8762f833a70dfbe7e3114066cd1232caa13;hpb=5b94c4decf6ac7d563b81e895c55c68c8a7f2561;p=plstackapi.git diff --git a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js index b479e87..76254f6 100644 --- a/planetstack/core/xoslib/static/js/xoslib/xosHelper.js +++ b/planetstack/core/xoslib/static/js/xoslib/xosHelper.js @@ -475,7 +475,7 @@ XOSDetailView = Marionette.ItemView.extend({ */ initialize: function() { - this.on("saveSuccess", this.onAfterSave); + this.on("saveSuccess", this.onSaveSuccess); this.synchronous = false; }, @@ -485,11 +485,20 @@ XOSDetailView = Marionette.ItemView.extend({ }); }, + 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) { @@ -559,9 +568,7 @@ XOSDetailView = Marionette.ItemView.extend({ 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; @@ -665,6 +672,7 @@ XOSDetailView = Marionette.ItemView.extend({ model: this.model, detailView: this, choices: this.options.choices || this.choices || this.model.choices || {}, + helpText: this.options.helpText || this.helpText || this.model.helpText || {}, }}, }); @@ -875,6 +883,7 @@ XOSDataTableView = Marionette.View.extend( { render: function() { var view = this; + var fieldDisplayNames = view.options.fieldDisplayNames || view.fieldDisplayNames || {}; view.columnsByIndex = []; view.columnsByFieldName = {}; @@ -882,7 +891,7 @@ XOSDataTableView = Marionette.View.extend( { 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); }; @@ -1007,7 +1016,9 @@ XOSDataTableView = Marionette.View.extend( { aaData.sort(function(a,b) { return compareColumns(sortCols, sortDirs, a, b); }); // slice it for pagination - aaData = aaData.slice(iDisplayStart, iDisplayStart+iDisplayLength); + if (iDisplayLength >= 0) { + aaData = aaData.slice(iDisplayStart, iDisplayStart+iDisplayLength); + } return fnCallback({iTotalRecords: totalSize, iTotalDisplayRecords: filteredSize,