Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha User conorarmstrong's Avatar
    Join Date
    Mar 2008
    Location
    Northern Ireland
    Posts
    224
    Vote Rating
    2
    conorarmstrong is on a distinguished road

      0  

    Default Ext.ux.form.AutoCombo - Combobox that populates choices when setting value

    Ext.ux.form.AutoCombo - Combobox that populates choices when setting value


    Another simple extension that we use regularly is a combobox that populates the choices when setting its value initially. This prevents a second request to the server requesting the data to show in the combo box. So for example, if you include this on a form, you could load data into the form with the following JSON:

    Code:
    {
        "success": true,
        "data": {
            "Id": 1234,
            "TextField1": "Value1",
            "ComboField1": {
                "value": 3,
                "records": [
                    [1,"Choice 1"],
                    [2,"Choice 2"],
                    [3,"Choice 3"],
                    [4,"Choice 4"]
                ]
            }
        }
    }
    the records can also be of the form: ["Id": 1,"Description": "Choice 1"] etc if the fields you want to populate in the model are not consecutive.

    The code for this modified combobox is as follows:

    Code:
    // vim: ts=4:sw=4:nu:fdc=4:nospell
    /**
    * @class Ext.ux.form.AutoCombo
    * @extends Ext.form.ComboBox
    *
    * A simple extension to the basic combo box that allows options to be populated when setting the fields value
    *
    * @author    Conor Armstrong
    * @copyright (c) 2011 Conor Armstrong
    * @date      28 April 2011
    * @version   0.1
    *
    * @history 
    * 0.1- 28 April 2011  - Initial Version
    * 0.2 - 10 May 2011  - Cases when loading objects
    * 0.3 - 20 Jun 2011  - Cases when passed array is empty. Stop loading a null array
    *
    * @license Ext.ux.form.AutoCombo.js is licensed under the terms of the Open Source
    * LGPL 3.0 license. Commercial use is permitted to the extent that the 
    * code/component(s) do NOT become part of another Open Source or Commercially
    * licensed development library or toolkit without explicit permission.
    * 
    * <p>License details: <a href="http://www.gnu.org/licenses/lgpl.html"
    * target="_blank">http://www.gnu.org/licenses/lgpl.html</a></p>
    *
    */
    
    Ext.define('Ext.ux.form.AutoCombo', {
      extend: 'Ext.form.ComboBox',
      alias: 'widget.autocombo',
     
      // defaults
      /**
       * Defines names that are used for "value" and "records" members
       */
      paramNames:{value:'value', records:'records'},
     
      setValue:function(value) {
        var val = value;
        if('object' === typeof val) {
          switch (Object.prototype.toString.call(val)) {
            case '[object Object]':
              if (val.getId) { 
                /* val is a model */
                val=val.getId();
              } else if (undefined !== val[this.paramNames['records']]) {
                /* val is an object containing records and value */
                if (val[this.paramNames['records']]) {
                  this.store.loadData(val[this.paramNames['records']]);
                }
                val = val[this.paramNames['value']];
              }
              break;
            case '[object Array]':
              val=val[0];
              if (val) {
                  val=val.getId();
              }
              break;
            default:
          }                   
        }
        this.callParent([val]);
      }
    });
    You would define the combobox, like any other. For example:

    Code:
    Ext.define('Country', {
      extend: 'Ext.data.Model',
      fields: [
        'Id',
        'Name'
      ],  
      idProperty: 'Id'
    });
    
    var combo=Ext.create('Ext.ux.form.AutoCombo', {
      width: '200',
      fieldLabel: 'Country',
      name: 'CountryId',
      typeAhead: true,
      queryMode:'local',
      emptyText: 'Please Select',
      store:Ext.create('Ext.data.Store', {
        model: 'Country'
      }),
      displayField:'Name',
      valueField:'Id',
      hiddenName:'CountryId'
    });
    Enjoy!
    Last edited by conorarmstrong; 20 Jun 2011 at 7:33 AM. Reason: bug fix
    ------------------------------------------
    Conor Armstrong
    tw: @evathedog
    web: rockstown.com

    Ext.ux.form.AutoCombo
    Ext.ux.SimpleIFrame
    Ext.ux.form.ToolFieldSet

    Knowledge is realising that the street is one-way, wisdom is looking both directions anyway.

  2. #2
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    213
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

    Default


    There is a user override for the ExtJS 3 combobox that loads only the currently selected record instead of all which is very useful for stores with a large number of elements for edit forms.
    Would be good to include that functionality here too.

  3. #3
    Sencha User conorarmstrong's Avatar
    Join Date
    Mar 2008
    Location
    Northern Ireland
    Posts
    224
    Vote Rating
    2
    conorarmstrong is on a distinguished road

      0  

    Default


    @abraxxa

    haven't seen that one. have you a link?
    ------------------------------------------
    Conor Armstrong
    tw: @evathedog
    web: rockstown.com

    Ext.ux.form.AutoCombo
    Ext.ux.SimpleIFrame
    Ext.ux.form.ToolFieldSet

    Knowledge is realising that the street is one-way, wisdom is looking both directions anyway.

  4. #4
    Ext JS Premium Member
    Join Date
    May 2008
    Location
    Austria, Vienna
    Posts
    213
    Vote Rating
    1
    abraxxa is on a distinguished road

      0  

  5. #5
    Sencha User conorarmstrong's Avatar
    Join Date
    Mar 2008
    Location
    Northern Ireland
    Posts
    224
    Vote Rating
    2
    conorarmstrong is on a distinguished road

      0  

    Default


    @abraxxa

    I've just had a look at that one. It appears the functionality you refer to relates to delaying execution of setValue until such time as the store is populated.

    In this extension, the server can provide both the value and all the options at the one time, so there would be no need for such a delay.

    In any event, I will (when I get some free time) add the additional delay to cover the case where options are not being provided.
    ------------------------------------------
    Conor Armstrong
    tw: @evathedog
    web: rockstown.com

    Ext.ux.form.AutoCombo
    Ext.ux.SimpleIFrame
    Ext.ux.form.ToolFieldSet

    Knowledge is realising that the street is one-way, wisdom is looking both directions anyway.

  6. #6
    Sencha User conorarmstrong's Avatar
    Join Date
    Mar 2008
    Location
    Northern Ireland
    Posts
    224
    Vote Rating
    2
    conorarmstrong is on a distinguished road

      0  

    Default


    @abraxxa

    lets see how this pans out first: http://www.sencha.com/forum/showthre...light=combobox
    ------------------------------------------
    Conor Armstrong
    tw: @evathedog
    web: rockstown.com

    Ext.ux.form.AutoCombo
    Ext.ux.SimpleIFrame
    Ext.ux.form.ToolFieldSet

    Knowledge is realising that the street is one-way, wisdom is looking both directions anyway.

  7. #7
    Sencha User conorarmstrong's Avatar
    Join Date
    Mar 2008
    Location
    Northern Ireland
    Posts
    224
    Vote Rating
    2
    conorarmstrong is on a distinguished road

      0  

    Default


    The records array can also be of the form:

    Code:
    ....
    records: [
      ["Id":1,"Description":"Choice 1"],
      ["Id":2,"Description":"Choice 2"]
    ] 
    ....
    if the fields you want to populate in the model are not consecutive. Id and Description to be replace with whatever fields you want to auto populate in your model.
    ------------------------------------------
    Conor Armstrong
    tw: @evathedog
    web: rockstown.com

    Ext.ux.form.AutoCombo
    Ext.ux.SimpleIFrame
    Ext.ux.form.ToolFieldSet

    Knowledge is realising that the street is one-way, wisdom is looking both directions anyway.

  8. #8
    Sencha User conorarmstrong's Avatar
    Join Date
    Mar 2008
    Location
    Northern Ireland
    Posts
    224
    Vote Rating
    2
    conorarmstrong is on a distinguished road

      0  

    Default


    Component updated to cover case when passed array is empty on initialisation.
    ------------------------------------------
    Conor Armstrong
    tw: @evathedog
    web: rockstown.com

    Ext.ux.form.AutoCombo
    Ext.ux.SimpleIFrame
    Ext.ux.form.ToolFieldSet

    Knowledge is realising that the street is one-way, wisdom is looking both directions anyway.

  9. #9
    Sencha User
    Join Date
    Jan 2012
    Posts
    1
    Vote Rating
    0
    destera is on a distinguished road

      0  

    Default


    Thank you so much for the extension. So how do i put the loading mask while its loading the data from store (remote/local) and comparing the records until its done?

Similar Threads

  1. Superselect combobox some times populates sometime doesn't
    By muncher in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 11 Aug 2010, 10:11 AM
  2. Setting Combobox with form.load() ?
    By Bucs in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 17 Apr 2009, 7:03 AM
  3. Setting default text for ComboBox form element
    By ettiene in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 11 Jun 2008, 12:36 AM
  4. IE7 combobox not showing choices
    By Sheckyd in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 15 Feb 2008, 3:18 PM
  5. UpdateManager always populates innerHTML
    By lkasdorf in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 6 Jul 2007, 11:31 AM

Thread Participants: 2