3

I'm trying to retrieve images from database to data view using ExtJS 4. Now I need to pass parameters dynamically. Mostly here..........

Ext.define('${pkgName}.v02x003001.SV02X00300102' , {
extend       : 'Ext.view.View',
alias        : 'widget.sv02x00300102',        
id           : 'images-view',
autoScroll   : true,
trackOver    : true,
multiSelect  : true,
height       : 310,
overItemCls  : 'x-item-over',
itemSelector : 'div.thumb-wrap',
emptyText    : 'No images to display',
prepareData  : function(data) {
    Ext.apply(data, {
        shortName : Ext.util.Format.ellipsis(data.name, 15),
        sizeString: Ext.util.Format.fileSize(data.size),
        dateString: Ext.util.Format.date(data.lastmod, "m/d/Y g:i a")
    });
    return data;
},    
initComponent: function() {
    var me   = this;
    var value= Ext.getCmp('member-sv02x00300104').getValue();
    me.store = 'S02X003001',
    me.tpl   = [
                '<tpl for=".">',
                '<div class="thumb-wrap" id="{name}">',
                '<div class="thumb"><img src="${createLink(mapping:'img', params:[member: **value** , width:100, height:100])}" title="{name}"></div>',
                '<span class="x-editable">{shortName}</span></div>',
                '</tpl>',
                '<div class="x-clear"></div>'
               ];

    me.callParent(arguments);
}

});

So my question is how do I set value into params ( for member field )

1 Answer 1

2

createLink is a grails component that is processes server side, before your JS code is run. You can't pass JS variables to a Java component because Java will always be processed first on the server and then the resulting HTML and JS will be sent to the client for processing. Client will know nothing about your server side code blocks.

I suggest you rewrite createLink piece in HTML and substitute in JS variables like you do with name and short name.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.