I have a view that shows items in the grid if a button is clicked to create a new line The popup window (use SimpleModel) is displayed to allow the user to save the row on the server. If everything goes well, the window is closed and the grid is refreshed to fix all the points at this point if I open the window another time, the record record event will be called twice. If I close the window for the third time, the event will be called three times, etc. I do not know that the incident is getting recovered several times. Here are my two thoughts:
View the field list:
var fieldListView = backbone. View. Extension ({L: "#centerbodycontent", Start: function () {_.bindAll (this, 'render', 'edfield');}, render: function () {$ (this.el) .empty () ; $ ("#GoldGridTemplate"). Tmpl ({result: this.model}) .appendTo (this.el) strip ($ (it.l.) .find ("dune"); Return to it;} Events: {"click on a # adfield": "edfilled"}, edfined: function) {Window.appController.popup = new fieldFormView ({Model: New Field Model ({contenttype_id: this.model.id}}}) ; Window.appController.popup.render ();} });
Form view (this is what is called for popup)
var fieldFormView = backbone. View. Click on "savefield", "savefield", "input change, text,": "changeField", "render:", "changefield", render: Function () {var formWrapper = $ (this .l) .find (".modal-form") [0]; $ (form webserver) .empty (); $ ("# field formattample is eaten"). Tmpl ({Results: This.model} .interform (form., "Add field", 450, 600); this return;}, // automatically changes the model during field changes Changes: Fixed: Function (e ) {Var changeobj = new object; Switch (e.target.type) {case "radio": changeobj [e.target.id] = parseInt ($ (e.target) .val ()); breakage; case "checkbox": changeobj [e.target. Id] = $ (e.target) .is (": check"); break; default: changeobj [e.target.id] = $ (e.target) .val (); break;; if (e.target .id.toLowerCase () == "name") {var k = $ (this.el) .find ("# key"); if (jQuery.trim (k.val ()). Length == 0) k .val ($ (e.target) .val (). Replace (/ [^ a-zA-Z0- 9] + / g, '') .toLowerCase ()); var l = $ (this.el). Find ("# label"); If (jQuery.trim (l.val ()). Length == 0) l.val ($ (e.target) .val ()); } Var option = {silence: true}; This.model.set (changeobj, option); }, Safefield: function (e) {var cocode = (ehic); Var thij = this; Var M = this.model; Var nextaction = e.target.id; Warning (nextaction); If (kcode == 0 || kcode == 1 || kcode == 32) {e.preventDefault (); If valid ($ ("$ contentfieldform") ({rule: {name: {required: true}, label: {required: true}, key: {required: true}}}.) Form ()) {m. Save (null, {headers: {"if-match": m.get ("version")}, error: function (model, response) {var errResp = JSON.parse (response.responseText); popupException ("content type Revision error ", errResp.errors [0].);}, Success: function (model, response) {window.appController.popup.model = new fieldModel; $ .PNotify ({pnotify_title: 'field saved', pnotify_text : 'The field was saved successfully.'}); If (next thing == "safefield and close") {$ .modal.close ();}}}); }}}}
After no response I thought I had any other issues In addition to this, it will add some more information in it. It is a good resource to explain what is happening (and provides a common solution) Also, the latest version of the spinal cord allows the cancellation of events from scenes There are some new ways to give
Comments
Post a Comment