[CLOSED] Get comobobox value and send it to javascript function

  1. #1

    [CLOSED] Get comobobox value and send it to javascript function

    Hi:

    I have a combo box column and I want to get one of the items of the combo box and assign it to a main store column
    This is the definition code for the combo box column:

    <ext:ComponentColumn runat="server" Editor="true" DataIndex="articuloid" Text="Articulo" Width="265">
    <Component>
       <ext:ComboBox runat="server" Editable="false" DisplayField="descripcion" ValueField="id" EmptyText="Seleccione un articulo" AllowBlank="False">                        
            <Store>
                <ext:Store ID="ArtList" runat="server" DataSourceID="SqlDataSourceArticulos">
                     <Model>
                         <ext:Model runat="server">
                             <Fields>
                                 <ext:ModelField Name="id" />
                                 <ext:ModelField Name="descripcion" />
                                 <ext:ModelField Name="cantidad" />
                              </Fields>
                          </ext:Model>
                      </Model>
                 </ext:Store>
             </Store>
             <Listeners>
                 <Select Handler="var record = records[0]; #{Disponible}.value = this.getStore().cantidad; "></Select>
             </Listeners>
             <ListConfig>
                 <ItemTpl runat="server">
                     <Html>
                        <div class="list-item">
                            <h4>{descripcion}</h4>
                            {cantidad}
                        </div>
                      </Html>
                 </ItemTpl>
              </ListConfig>
         </ext:ComboBox>
    </Component>
    </ext:ComponentColumn>
    When the user see the field on the page it looks like this
    Click image for larger version. 

Name:	ComboBox.PNG 
Views:	2 
Size:	16.4 KB 
ID:	25120


    In the image, you can see, the name of the article and a quantity available.
    When the user select one of the items, the combo box take the id (<ext:ModelField Name="id" />) and thats the value will be assign to the column (<ext:ComponentColumn runat="server" Editor="true" DataIndex="articuloid" Text="Articulo" Width="265">)

    But I want to get another value of the combo box, the <ext:ModelField Name="cantidad" /> and assign the value to the column <ext:Column ID="Disponible" runat="server" DataIndex="disponible" Text="Disp" Width="0"> </ext:Column>

    In the image per example, if the user select
    BlueRay Player
        articuloid = 1
        disponible = 9
    
    Televisor LED 50"
        articuloid = 5
        disponible = 20
    How can I get the <ext:ModelField Name="cantidad" />, when the user select an item from the combo box????

    Thanks
    Last edited by fabricio.murta; Mar 17, 2018 at 7:17 AM. Reason: Format post
  2. #2
    Hello @aemiranda!

    The record variable has all you want. By what you describe, it will be record.getData().cantidad. Or, rather record.set("cantidad", value_from_combobox).

    I hope this helps!
    Fabrício Murta
    Developer & Support Expert
  3. #3

    Thanks

    Thanks fabricio.
    The first solution you wrote works: record.getData().cantidad

    Abdel

Similar Threads

  1. Replies: 1
    Last Post: Feb 10, 2015, 4:45 AM
  2. [CLOSED] Get javascript function's value
    By multimediait in forum 2.x Premium Help
    Replies: 6
    Last Post: Oct 24, 2014, 11:20 AM
  3. Replies: 3
    Last Post: Oct 23, 2013, 4:30 PM
  4. Calling JavaScript function
    By UserClarion in forum 1.x Help
    Replies: 2
    Last Post: Dec 30, 2011, 11:23 AM
  5. Replies: 1
    Last Post: Apr 08, 2010, 7:28 PM

Posting Permissions