• 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.

Ext.apply syntax question

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

  • Ext.apply syntax question

    I know I'm very close here but not sure the exact way to do this. My current example below gave me the field values but not the name=value pair I need. I'm using RowEditor and trying to pass all fields from store record in one shot after Update is clicked. I do it with Form all the time but first time I've tried with RowEditor AJAX call. Thanks!

    updateRec : function(record) { var parms = { pgm: 'VALV862', action: 'updRec' }; Ext.apply(parms, record.data); Ext.Ajax.request({ url: '/valence/vvcall.pgm', params: { pgm: 'VALV862', action: 'updRec', params: parms,

  • #2
    Terry,

    If using the row editing plugin the event "edit" is fired when the user clicks update on the grid that passes two parameters. The first parameter is the editor and the second one is the context that contains the record etc.

    Example :
    Code:
    grid.on('edit', function(editor, e) {
        var params = {
            pgm    : 'VALV862',
            action : 'updRec'
        };
        Ext.apply(params, e.record.data);
        // AJAX Call
        // ....
    });
    When posting source code please wrap it in code tags that way it's easy for everyone to read. Thanks

    Comment


    • #3
      Wow, that was it. I was having edit listener just pass e.record to the function that makes AJAX call. Something about that was messing up the apply. When I passed in e object as you suggested, it then worked to give me the field/value pairs. This extjs is a strange beast to tame. :o Thanks Johnny!

      Comment


      • #4
        ps What do you mean by "code tags"? The code looked OK when I pasted it in, didn't see the spacing disappeared until I hit Post. I'm not a professional poster. :-)

        Comment


        • #5
          You should see a difference in the code I posted vs the code you posted. That is because I wrapped it in code tags. You can access the code tags from within the advanced editor.

          Attached is an image of the buttons I am referring to. ThanksForum Code Tags.png

          Comment


          • #6
            Oh, I saw difference. :-) I always wondered how forums got that block around the code. I'm testing below, ignore.

            Code:
            xtype: 'numberfield', itemId: 'newcu', name: 'newcu', margin: '5,0,0,0', labelWidth: 70, width: 140, fieldLabel: 'Copper %', minValue: 0, maxValue: 9.99, allowBlank: false, allowDecimals: true, decimalPrecision: '2', hideTrigger: true, keyNavEnabled: false, mouseWheelEnabled: false

            Comment


            • #7
              Well, it's better. It still lost all the CR/LF and Tab spacing I have in Webstorm editor. If any tips on how to keep that, let me know.

              Comment

              Working...
              X