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

Retrieve value from array record

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

  • Retrieve value from array record

    I am trying to modify some code to retrieve the "original" value of a record. I'm sure there is another way to do this, but I really would like to know how to retrieve the raw value of an array. I have the following code:

    Code:
    	processRecords: function(button, event, eOpts) {
    		var me = this,
    			records = me.getDetailPanel().getStore().getRange();
    
    		Ext.Array.each(records, function(rec, index) {
    			if (rec.dirty === true) {
                    
                    console.log(rec);
    When I look at the console, and "expand" the object, I see data and raw. After doing some research, it seems raw will always contain the value of index prior to converting to the new value. I need that raw value. How do I retrieve that value? I tried rec.raw.FIELD and that didn't work. get() will retrieve the value from data. getRaw is not a valid method. How do I retrieve that value? It might be important to add that this array is coming in from a store that is used for a grid.
    Last edited by rkanemeier; 08-12-2014, 10:30 AM.

  • #2
    The raw object can't strictly be relied upon. It's defined as "The raw data used to create this model if created via a reader."

    I bet these values are there sometimes.

    I am surprised that rec.raw.FIELD didn't work! What is in the raw values when you 'expand' the object, is it perhaps a long string?

    You may want to keep track of the original values on your own and compare or retrieve them as needed.

    Comment


    • #3
      Eric,

      Thanks for your response. However, let's call this a "teaching me how to fish" scenario. How do I get the value of rec.raw.FIELD? If I can see something in the console, shouldn't I be able to "get to it" and get a value? The reason I'm stubborn about this is because ran into this many times before and I had to jump through hoops to get around it (when it should be as easy as getRaw() or something). Any help you can provide to get rec.raw.field would be appreciated. The workaround has been in the works (adding hidden fields in the grid that contain the original values....a childish workaround)

      Comment


      • #4
        Can you screenshot or copy paste in the results of the console.log?

        Comment


        • #5
          Eric,

          Thanks again for your time/help/response. This is excruciatingly frustrating, but for some reason it works now. I literally changed nothing. So rec.raw.field is now pulling back the value I'm looking for (even though I already coded for the hidden fields).

          Comment

          Working...
          X