1. #1
    Ext User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    near_sun is on a distinguished road

      0  

    Question extend ComboBox

    extend ComboBox


    //code TreeComboBox.js

    Code:
     
     
    Ext.ux.TreeComboBox = Ext.extend(Ext.form.ComboBox, {
        extStore: null,
        tree: null,
        treeId: 0,
        setValue: function(v) {
            var text = v;
            if (this.valueField) {
                var r = this.findExtRecord(this.valueField, v);
                if (r) {
                    text = r.data[this.displayField];
                } else if (this.valueNotFoundText !== undefined) {
                    text = this.valueNotFoundText;
                }
            }
            Ext.ux.TreeComboBox.superclass.setValue.call(this, text);
            this.lastSelectionText = text;
            if (this.hiddenField) {
                this.hiddenField.value = v;
            }
            this.value = v;
        },
        initComponent: function() {
            this.treeId = Ext.id();
            this.focusLinkId = Ext.id();
            Ext.apply(this, {
                store: new Ext.data.SimpleStore({
                    fields: [],
                    data: [[]]
                }),
                editable: false,
                shadow: false,
                mode: 'local',
                triggerAction: 'all',
                maxHeight: 200,
                tpl: '<tpl for="."><div style="height:200px"><div id="'
                + this.treeId + '"></div></div></tpl>',
                selectedClass: '',
                onSelect: Ext.emptyFn,
                valueField: 'id'
            });
            var treeConfig = {
                border: false,
                rootVisible: false
            };
            Ext.apply(treeConfig, this.treeConfig);
            if (!treeConfig.root) {
                treeConfig.root = new Ext.tree.AsyncTreeNode({
                    text: 'treeRoot',
                    id: '0'
                });
            }
            this.tree = new Ext.tree.TreePanel(treeConfig);
            this.on('expand', this.onExpand);
            this.tree.on('click', this.onClick, this);
            Ext.ux.TreeComboBox.superclass.initComponent.apply(this,
            arguments);
        },
        findExtRecord: function(prop, value) {
            var record;
            if (this.extStore != null) {
                if (extStore.getCount() > 0) {
                    extStore.each(function(r) {
                        if (r.data[prop] == value) {
                            record = r;
                            return false;
                        }
                    });
                }
            }
            return record;
        },
        onClick: function(node) {
            if (node.attributes.parameter == 9) {
                // 
            } else {
                // 
                this.setValue(node.text);
                this.hiddenField.value = node.id;
                this.collapse();
            }
        },
        onExpand: function() {
            this.tree.render(this.treeId);
        }
    });
    Ext.reg("Ext.ux.treecombobox", Ext.ux.TreeComboBox);
    //create TreeComboBox

    {
    xtype: 'Ext.ux.treecombobox',
    extStore :3, //have no effect ,extStore is still null,Why????
    ...............................
    }

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Format your post. It is unreadable.

    http://extjs.com/forum/showthread.php?t=43718

  3. #3
    Ext User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    near_sun is on a distinguished road

      0  

    Default


    the property extStore is not 3, but null . why?

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    There is no variable called extStore. You did not declare one.

    Properties of the config, are copied into the Component.

  5. #5
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Code:
            if (this.extStore != null) {
                if (extStore.getCount() > 0) {
    See the difference between those two lines?

  6. #6
    Ext User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    near_sun is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal View Post
    Code:
            if (this.extStore != null) {
                if (extStore.getCount() > 0) {
    See the difference between those two lines?
    Code:
            if (this.extStore != null) {//I set break point , the value of this.extStore is null,not 3
                if (extStore.getCount() > 0) {

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,498
    Vote Rating
    47
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    And what is this when you break there?

  8. #8
    Ext User
    Join Date
    Dec 2008
    Posts
    4
    Vote Rating
    0
    near_sun is on a distinguished road

      0  

    Default


    thank you for your help
    Issue is resolved

    after I checked the value of this,I find myself made a mistake.

  9. #9
    Ext Premium Member
    Join Date
    Mar 2010
    Posts
    42
    Vote Rating
    0
    jasmina is on a distinguished road

      0  

    Default Need info on how to use it

    Need info on how to use it


    Hi All,

    I need a treecontrol in a combobox. Need some info on how to use it. How do i pass the store to the tree... Can you share a working example?

  10. #10
    Ext Premium Member
    Join Date
    Mar 2010
    Posts
    42
    Vote Rating
    0
    jasmina is on a distinguished road

      0  

    Default


    Basically i need the json store representation...

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi