1. #1
    Ext User
    Join Date
    Oct 2007
    Location
    Hungary
    Posts
    136
    Vote Rating
    0
    slobo is on a distinguished road

      0  

    Default [FIXED][2.x] DataView tpl config option bug

    [FIXED][2.x] DataView tpl config option bug


    the DataView's tpl config option
    does not accept an array of strings (HTML fragments)
    as stated in the docs
    (can only accept a string or an XTemplate - this can also clearly be seen from the source code of DataView)

    (I think this should be handled as a programming bug, not as a docs problem)

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    8,189
    Vote Rating
    63
    aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice aconran is just really nice

      0  

    Default


    slobo -

    Thanks for the bug report. We've added this into our issue tracker and will take a look at it.

    Thanks,
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,232
    Vote Rating
    2
    mystix will become famous soon enough

      0  

    Default


    this bug's still present in 2.2.

    bugfix for this is trivial:
    Code:
    Ext.override(Ext.DataView, {
        // private
        initComponent : function() {
            Ext.DataView.superclass.initComponent.call(this);
            if (typeof this.tpl == "string" || Ext.type(this.tpl) == "array") {
                this.tpl = new Ext.XTemplate(this.tpl);
            }
    
            this.addEvents(
                "beforeclick",
                "click",
                "mouseenter",
                "mouseleave",
                "containerclick",
                "dblclick",
                "contextmenu",
                "selectionchange",
                "beforeselect"
            );
    
            this.all = new Ext.CompositeElementLite();
            this.selected = new Ext.CompositeElementLite();
        }
    });

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    41
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Maybe, instead, we should check if it is not a usable template class:

    Code:
    Ext.override(Ext.DataView, {
    	initComponent : function(){
    		Ext.DataView.superclass.initComponent.call(this);
    		if(this.tpl && !this.tpl.overwrite){
    			this.tpl = new Ext.XTemplate(this.tpl);
    		}
    		this.addEvents(
    			"beforeclick",
    			"click",
    			"mouseenter",
    			"mouseleave",
    			"containerclick",
    			"dblclick",
    			"contextmenu",
    			"selectionchange",
    			"beforeselect"
    		);
    		this.all = new Ext.CompositeElementLite();
    		this.selected = new Ext.CompositeElementLite();
    	}
    });

  5. #5
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    15,102
    Vote Rating
    97
    evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold evant is a splendid one to behold

      0  

    Default


    Fixed in SVN.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!