How to get ModelField Value in ComboBox

  1. #1

    How to get ModelField Value in ComboBox

    Hi,

    I am using a combobox and I have 3 model fields with it. I can get the values of LocationName and ZipCode by assigning them to Display Field and Value Field. My problem is I don't know where to assign the UserID. I need to pass it as a parameter when calling ChangeLocation function. Another alternative is to call the store and get the records inside it, but I don't know how to do it. I have tried using ComboBoxLocation.getStore().model.element(0).Field s.ElementAt(2). It gives me the details about the modelfield UserID, but not the values. I need the value itself. Please help. Thanks in advance.

    ext:ComboBox ID="ComboBoxLocation" runat="server" Mode="Local" ForceSelection="true" Editable="false" FieldLabel="ChangeLocation" DisplayField="LocationName" ValueField="ZipCode" Width="300" SelectedIndex="1">
    <Store>
          <ext:Store ID="StoreLocations" runat="server">
          <Model>
                  <ext:Model ID="Model1" runat="server">
                          <Fields>
                                 <ext:ModelField Name="LocationName" />
                                 <ext:ModelField Name="ZipCode" />
                                 <ext:ModelField Name="UserID" />
                          </Fields>
                   </ext:Model>
           </Model>            
           </ext:Store>    
    </Store>                                       
           <Listeners>
                  <Select Handler="changeLocation(this.getValue());" />                       
           </Listeners>
    </ext:ComboBox>
  2. #2
    Hello!

    Select event's handler receives the array of selected records as second parameter: http://docs.sencha.com/extjs/4.1.3/#...x-event-select

Similar Threads

  1. [CLOSED] Filtering a store with a ModelField of Type Object
    By csfesta in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Nov 18, 2013, 4:40 AM
  2. [CLOSED] datetime format in ModelField?
    By hdsoso in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 18, 2013, 12:20 PM
  3. [CLOSED] Mapping on ModelField
    By ptrourke in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 18, 2013, 12:45 AM
  4. [CLOSED] ModelField DateFormat problem
    By mirwais in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 01, 2013, 12:40 PM
  5. ext:ModelField Mapping attribute not working
    By jbarbeau in forum 2.x Help
    Replies: 5
    Last Post: Jan 14, 2013, 10:01 AM

Tags for this Thread

Posting Permissions