1. #1
    Sencha User coshmos's Avatar
    Join Date
    Apr 2012
    Posts
    18
    Answers
    2
    Vote Rating
    1
    coshmos is on a distinguished road

      0  

    Default Answered: Display an image in grid column

    Answered: Display an image in grid column


    Hi, everyone.

    I made a grid and need to display an image for every record in one of the column.
    A grid are made this way:
    Code:
            var grid = Ext.create('Ext.grid.Panel', {
                id: 'GridDataFromCreateForm',
                store: store,
                columns: [{
                    header: 'Name',
                    dataIndex: 'name',
                    flex: 3
                }, {
                    header: 'Category',
                    dataIndex: 'category',
                    flex: 5
                }, {
                    header: 'Shelf',
                    dataIndex: 'shelf',
                    flex: 2
                }, {
                    header: 'Amount',
                    dataIndex: 'amount',
                    flex: 2,
                    editor: {
                        xtype: 'numberfield',
                        allowBlank: false,
                        minValue: 0,
                        maxValue: 100000
                    }
                }, {
                    header: 'Photo',
                    dataIndex: 'photo',
                    flex: 2 {
                        xtype: 'actioncolumn',
                        flex: 0.5,
                        items: [{
                            icon: this.initialConfig.baseAppUrl + 'Themes/Default/Images/Dictionary_Action_Remove_16x16.png',
                            tooltip: 'Sell stock',
                            handler: function (grid, rowIndex, colIndex) {
                                var rec = store.getAt(rowIndex);
                                me._beginRemove(rec, store);
                            }
                        }]
                    }], selModel: {
                    selType: 'cellmodel'
                },
                title: 'Your fruits',
    
    
                tbar: [
                productSelect,
                {
                    xtype: 'button',
                    text: 'Add fruit',
                    handler: addSelectedFruit
                }],
                plugins: [cellEditing]
                });
             this.on('beforesubmit', function () {
                me.params = {};
    
    
                var i = 0;
                store.each(function (x) {
                    me.params['createdto.entries[' + i + '].product.id'] = x.get('productId');
                    me.params['createdto.entries[' + i + '].amount'] = x.get('amount');
                    i++;
                });
            });
             cellEditing.on('edit', function (x, y, z) {
                me.recount(store);
            });
    
    
            return grid;
            }
    And at the Photo header I need to place a photo, which addreess is represented in dataIndex: 'photo'. Could I make it dynamically? Or before I don't return the grid, I don't have anything in dataIndex: 'photo'?
    *I tried render, but nothing was happened.

  2. Try this:
    Code:
    ...
    },{
        header: 'Photo',
        dataIndex: 'photo',
        renderer: function(value){
            return '<img src="' + value + '" />';
        },
        ...
    },{
    ....

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    109
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Try this:
    Code:
    ...
    },{
        header: 'Photo',
        dataIndex: 'photo',
        renderer: function(value){
            return '<img src="' + value + '" />';
        },
        ...
    },{
    ....

  4. #3
    Sencha User coshmos's Avatar
    Join Date
    Apr 2012
    Posts
    18
    Answers
    2
    Vote Rating
    1
    coshmos is on a distinguished road

      0  

    Default


    Nothing happened and Chrome's JS console shows this error:
    Uncaught TypeError: Cannot read property 'dom' of undefined

    UPDATE: Done, I've got wrong url. Thanks.

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar