• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

[SOLVED] Ext.grid.plugin.CellEditing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    makes no sense to me but as long as i console.log(changedRecords) after my dirty routine and before my ajax routine it works fine.

    Code:
        onSaveTaxIdButton: function() {
         	var changedRecords = [];
    
    		for (c = 0; c < this.getStore('AP1099s').count(); c++) {
    			if (this.getStore('AP1099s').data.items[c]["dirty"] === true) {
    				var dirtyRecord = this.getStore('AP1099s').data.items[c];
    				changedRecords[c] = dirtyRecord;
    			}
    		}
            
           console.log(changedRecords); //as long as I put this in the plucker plucks.... 
            
    		if (changedRecords.length > 0) {
                
                          var recs = Ext.Array.pluck(changedRecords, 'data');
                
    			Ext.getBody().mask();
    			Ext.Ajax.request({
    				url: 'vvcall.pgm',
    				params: {
    					pgm: 'ap1099zr',
    					action: 'updateTaxID',
    					changes: Ext.encode(recs)
    				},
    				scope: this,
    				success: function(response) {
    					Ext.getBody().unmask();
    					var d = Ext.decode(response.responseText);
    					if (d.SUCCESS === '1') {
    						this.getStore('AP1099s').load();
    						Valence.util.msg('Saved', d.NUMBERSAVED + ' Tax ID Changes');
    					} else {
    						Ext.Msg.show({
    							title: 'Error',
    							msg: 'An error occurred....',
    							icon: Ext.Msg.ERROR
    						});
    					}
    				}
    			});
    		}
    	},

    Comment


    • #17
      Mystery Solved.... the changedRecords array contained blank elements because I used the same counter from the for loop.
      Once I only incremented the changedRecords array by 1 for each dirty record found, then the plucker plucked.

      All that being said, I'm still going to try it the "cleaner" way and see if I can figure it out.

      Comment


      • #18
        Check out this other non Ext function I used, Array.push()

        http://www.w3schools.com/jsref/jsref_push.asp

        And consider the Ext.data.Store.getAt instead of store.items.data[index].

        Also, when using variable[squareBracketAccessWithIndex] it is advised not to use hard coded string value, for example: ace["jock"] would be better as ace.jock

        Comment


        • #19
          I will check it out. I found that routine via google and noticed the warning error in the editor. still not good enough at javascript yet to figure it all out. but at least it's working for the mean time. i was pushed for time.

          Comment


          • #20
            Why not this code:

            http://cnxforum.com/showthread.php?1...=4420#post4420

            Comment


            • #21
              no reason other than I was so close to getting it to work the way it was and wanted to figure it out rather than try something new at that point. I will try it though.

              Comment

              Working...
              X