1. #1
    Sencha Premium Member
    Join Date
    Nov 2011
    Location
    Portland, Oregon
    Posts
    18
    Vote Rating
    0
    Answers
    1
    isiphil is on a distinguished road

      0  

    Default Unanswered: Beta3 DataView XTemplate question now using itemTpl instead of tpl

    Unanswered: Beta3 DataView XTemplate question now using itemTpl instead of tpl


    Before Beta 3 we had a DataView that utilized an XTemplate to create one Header at the top using the x-toolbar class. I am struggling to mimic the following behavior. Any suggestions or pointers would be appreciated.

    Code:
    Ext.namespace('csi'); csi.wo__template = new Ext.XTemplate('<div><table class="invCLhead">',
    								'<tr class="x-toolbar x-toolbar-dark" style="font-weight: bold; color:white; vertical-align: middle;">',									
    									'<td class="invCLdsHead">Description</td>',
    									'<td class="invCLstHead">Status</td>',
    								'</tr></table></div>',
                                     '<tpl for=".">',
                                        '<div id = "div.clwrap">',
                                        '<table class="invCL"><tr>',                                    
                                        '<td class="invCLds">{question}</td>',
                                        '<td class="invCLst">{response}</td>',
                                        '</tr></table></div>',
                                    '</tpl>'
                                    );
                                            
    Ext.define('csi.view.WorkorderDataview',{
    	extend: 'Ext.DataView',
    	xtype: 'workorderDataview',
    	config: {
    	    title: "wo_dataview",
    	    useComponents: true,
    	    tpl: csi.wo_template,
    	    selectorId: 'workorderDataview',
    	    store: 'Workorder',
    	    scrollable: false,           
    	    emptyText:'<div class="emptytext">None Available<br></div><hr>'
    	}
    });
    This is the modified code in Beta3. I can get the DataView to render. However, Since the itemTpl is rendered for each line, I get the toolbar header everytime. Is it possible to get it only to render the first time?

    Code:
    Ext.namespace('csi'); csi.wo_template = new Ext.XTemplate('<div><table class="invCLhead">',
    								'<tr class="x-toolbar x-toolbar-dark" style="font-weight: bold; color:white; vertical-align: middle;">',									
    									'<td class="invCLdsHead">Description</td>',
    									'<td class="invCLstHead">Status</td>',
    								'</tr></table></div>',
                                     '<tpl for=".">',
                                        '<div id = "div.clwrap">',
                                        '<table class="invCL"><tr>',                                    
                                        '<td class="invCLds">{question}</td>',
                                        '<td class="invCLst">{response}</td>',
                                        '</tr></table></div>',
                                    '</tpl>'
                                    );
                                            
    Ext.define('csi.view.WorkorderDataview',{
    	extend: 'Ext.DataView',
    	xtype: 'workorderDataview',
    	config: {
    	    title: "wo_dataview",
    	    itemTpl: csi.wo_template,
    	    selectorId: 'workorderDataview',
    	    store: 'Workorder',
    	    scrollable: false,           
    	    emptyText:'<div class="emptytext">None Available<br></div><hr>'
    	}
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    Answers
    3160
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    You can add a docked toolbar to the dataview or you can insert the element into the dataview list. You cannot do it with the template is what I am saying.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha Premium Member
    Join Date
    Nov 2011
    Location
    Portland, Oregon
    Posts
    18
    Vote Rating
    0
    Answers
    1
    isiphil is on a distinguished road

      0  

    Default


    Mitchell,
    Thanks for the quick response. That is what I was thinking but I just wanted to double check. I was just looking at your view.js file inside of Ext.ux.touch.grid. It looks like you use the docked toolbar as you suggest. We use this elsewhere in our app and I may just change this dataview into a grid.
    Thanks again.