[CLOSED] How to get the value for the IdProperty in a Model

  1. #1

    [CLOSED] How to get the value for the IdProperty in a Model

    Hi,
    Currently I have a js that deletes a selected row in a GridPanel. I would like to retrieve the value of the IdProperty(ProductId in my case) for the selected row.
    Can you please show me how to get it? I tried using
    sm.selected.get.IdProperty
    but returned me a "object underfine" error message.
    Below is the code:
    var deleteProduct = function(sender, args, record, value, rec) {
                    var grid = #{grdProducts};
                    Ext.Msg.confirm("Confirm", "Are you sure you wish to remove the selected products?", function(result) {
                             if (result == "yes") {   
                             debugger;                 
                                  sm = grid.getSelectionModel();
                                  var test = sm.selected.get.IdProperty;
                                    grid.store.remove(sm.getSelection());
                             }                             
                    }); 
                }
    Below is my Model markup:
     <Model>
        <ext:Model runat="server" Name="Products" IDProperty="ProductId">
            <Fields>
                <ext:ModelField Name="UPCCode" Type="String" />
                <ext:ModelField Name="DamageCount" Type="Int" />
        </Fields>
        </ext:Model>
    </Model>
    Last edited by Daniil; Aug 03, 2012 at 3:07 PM. Reason: [CLOSED]
  2. #2
    Hi,

    If there is a single selection, then:
    sm.getSelection()[0].getId()
  3. #3
    Thank you! That was it.

    Quote Originally Posted by Daniil View Post
    Hi,

    If there is a single selection, then:
    sm.getSelection()[0].getId()

Similar Threads

  1. Replies: 0
    Last Post: May 16, 2012, 4:35 PM
  2. [CLOSED] Setting the IDProperty when using a TreePanel
    By RCN in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: May 11, 2012, 7:57 PM
  3. [CLOSED] PartialViewResult and Model
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 26
    Last Post: Feb 14, 2011, 9:23 PM
  4. [CLOSED] CheckBoxSelection model
    By jwaite in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 17, 2010, 7:33 AM
  5. [CLOSED] Can SelectionModel have two model
    By pank in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Sep 02, 2009, 9:13 AM

Posting Permissions