Skip to content

Error with template columns #7

@abenhamdine

Description

@abenhamdine

Hi, and thx again for this useful module !

I have the following grid, with several template columns:

{
        xtype: 'grid',
        width: '100%',
        flex: 1,
        componentCls: 'arh-task-list',
        store: Arhia.Globals.getStore('mdlTSK_L', 0, true),
        columns: [{
            dataIndex: 'tsks_id',
            width: 40,
            xtype: 'templatecolumn',
            tpl: new Ext.XTemplate(`
			 <tpl if="tsks_id = 1">
			 		<svg aria-hidden="true" class="icon open" height="16" version="1.1" viewBox="0 0 14 16" width="14"><path fill-rule="evenodd" d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z">
					</path>
					</svg> 
			<tpl elseif="tsks_id= 2">
					<svg aria-hidden="true" class="icon closed" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M7 10h2v2H7v-2zm2-6H7v5h2V4zm1.5 1.5l-1 1L12 9l4-4.5-1-1L12 7l-1.5-1.5zM8 13.7A5.71 5.71 0 0 1 2.3 8c0-3.14 2.56-5.7 5.7-5.7 1.83 0 3.45.88 4.5 2.2l.92-.92A6.947 6.947 0 0 0 8 1C4.14 1 1 4.14 1 8s3.14 7 7 7 7-3.14 7-7l-1.52 1.52c-.66 2.41-2.86 4.19-5.48 4.19v-.01z"></path></svg>
			<tpl elseif="tsks_id= 3">
					<svg aria-hidden="true" class="icon closed" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M7 10h2v2H7v-2zm2-6H7v5h2V4zm1.5 1.5l-1 1L12 9l4-4.5-1-1L12 7l-1.5-1.5zM8 13.7A5.71 5.71 0 0 1 2.3 8c0-3.14 2.56-5.7 5.7-5.7 1.83 0 3.45.88 4.5 2.2l.92-.92A6.947 6.947 0 0 0 8 1C4.14 1 1 4.14 1 8s3.14 7 7 7 7-3.14 7-7l-1.52 1.52c-.66 2.41-2.86 4.19-5.48 4.19v-.01z"></path></svg>
					<tpl else>
					n/a
			</tpl>
			`)
        }, {
            text: "Echéance",
            flex: 1,
            dataIndex: 'due_by',
            xtype: 'templatecolumn',
            tpl: new Ext.XTemplate(`
			<tpl>
            	{due_by}
			</tpl>
			`)
        }, {
            text: "Tâche",
            flex: 2,
            dataIndex: 'tsk_title',
            xtype: 'templatecolumn',
            tpl: new Ext.XTemplate(`
			<tpl>
            	{tsk_title}
			</tpl>
			`)
        }, {
            text: "Labels",
            flex: 1,
            dataIndex: 'labels',
            xtype: 'templatecolumn',
            tpl: new Ext.XTemplate(`
			<tpl for="labels">
				<span style="background-color:{color}" class="labels label">{lib}</span>
			</tpl>
			`)
        }, {
            text: "Assignée à",
            flex: 1,
            shrinkWrap: 2,
            dataIndex: 'assignees',
            xtype: 'templatecolumn',
            tpl: new Ext.XTemplate(`
			<tpl for="assignees">
				<span class="assignees label">{.}</span>
			</tpl>
			`)
        }, {
            text: "Revue par",
            flex: 1,
            dataIndex: 'reviewers',
            xtype: 'templatecolumn',
            tpl: new Ext.XTemplate(`
			<tpl for="reviewers">
				<span class="reviewers label">{.}</span>
			</tpl>
			`)
        }]
}    

and the export triggers the following error:

Uncaught TypeError: Cannot read property 'tpl' of undefined
    at constructor.generateWorksheets (:8889/ux/ExportableGrid.js?_dc=1498559830679:573)
    at constructor.generateXl (:8889/ux/ExportableGrid.js?_dc=1498559830679:340)
    at constructor.generateStructure (:8889/ux/ExportableGrid.js?_dc=1498559830679:264)
    at constructor.export (:8889/ux/ExportableGrid.js?_dc=1498559830679:89)
    at constructor.exportGrid (:8889/framework/arhWidgetGrid.js?_dc=1498559830565:374)
    at constructor.callback (:8889/framework/arhWidgetGrid.js?_dc=1498559830565:207)
    at Object.callback (ext-all-debug.js:8442)
    at constructor.onClick (ext-all-debug.js:132837)
    at constructor.fire (ext-all-debug.js:20226)
    at constructor.fire (ext-all-debug.js:32466)

I will investigate when I have some time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions