Sunday, July 15, 2012

ExtJs Hierarchical Grid Alignment Issue in child grid

If you are using ExtJS 3.X and rowexpander plugin you will see that in the child grid alignment of the columns will be messed up compared to header in the child grid.

THAT IS BUG IN EXTJS ON COMPUTING WIDTH OF CHILD GRID COLUMN HEADER!

The root cause for this issue is while calculating the width of columns (compared to header) Ext code is not computing it correctly. To avoid this mismatch between header columns and data columns follow below instruction.

Lets say below is rowexpander implementation for hierarchical grid -

new Ext.grid.RowExpander({
 exapndOnEnter: false,
 expandOnDblClick: false,
 tpl: '<div class='x-sample-rowexpander"></div>',
 listeners:{
         scope: this,
         expand: function(…){
                 ……..
         },
         collapse: function(…){
                ............
        }
})

based on grid config's width, put override as listed below for class specified in rowexpander div -

.x-sample-rowexpander .x-panel-bwrap .x-panel-body .x-grid3 .x-grid3-viewport .x-grid3-scroller .x-grid3-body .x-grid3-row table.x-grid3-row-table {
    width:1175px !important;
}

.x-sample-rowexpander .x-panel-bwrap .x-panel-body .x-grid3 .x-grid3-viewport .x-grid3-scroller .x-grid3-body .x-grid3-row{
    width:1175px !important;
}

Here 1175px is for my grid's implementation, you will need to calculate your grid's column width and try above override. Feel free to drop better suggestion :) 

Django Application Image issues while running on mac

If you are using django and getting jpg adapter error on image upload or while running the app on rendering the jpeg image, in that case follow below instructions. The error is most likely because of installation of jpeg in environment.


You have to install support for JPEG, for example in mac use homebrew for installation and follow below instructions - 

1. Uninstall PIL
    sudo pip uninstall PIL

2. Install JPEG
    brew install jpeg

3. Install PIL again
    sudo pip install PIL

for ubuntu users use below command -
sudo apt-get install libjpeg62-dev