PDA

View Full Version : Sencha Touch Grid: Percentage based width for columns



u25771
15 Mar 2014, 9:46 AM
Hey guys,

I managed to build a workaround until the percentage width is supported by Sencha Touch.

Link to Blogpost:
http://abitofcoding.blogspot.com/2014/03/sencha-touch-grid-percentage-based-width.html

S (http://abitofcoding.blogspot.com/2014/03/sencha-touch-grid-percentage-based-width.html)hort Demo:
https://dl.dropboxusercontent.com/u/2056172/KeepAlive/GridPrecentageWidth/ExampleProject/index.html
(https://dl.dropboxusercontent.com/u/2056172/KeepAlive/GridPrecentageWidth/ExampleProject/index.html)

After many feedbacks and questions to the content which was not automatically adjusted I decided to give you an idea how to do this. I had exams last month so I did not have time until now, sorry for this.


Feedbacks would be nice!

Trozdol
2 Apr 2014, 7:13 AM
This is awesome! Thanks for this! Based on your example I got the column headers to size correctly but what about the grid columns cells? They just collapse to the size of the content.

Any guidance you might have is appreciated.

Thanks!

u25771
7 Apr 2014, 6:02 AM
This is awesome! Thanks for this! Based on your example I got the column headers to size correctly but what about the grid columns cells? They just collapse to the size of the content.

Any guidance you might have is appreciated.

Thanks!

What exactly are you talking about? :D Any screenshots or code would be helpful, I have no clue what your problem is :)

blueterry
8 May 2014, 7:15 PM
hello u25771 :I understand what Trozdol means and facing the same problem here:According to your code, the column headers are working perfectly, however, when the data loaded and rows generated, the width of each cell in the row is not the same with the header cells. i.e. the row is not 100% width in length.Thanks in advance

I've just added one line after "column.bodyElement.setWidth(pxWidth);" in the renderColumnPercentage function :

column._width = pxWidth;

and the problem solved. I know it looks ugly, it's solved my problem now....

u25771
8 May 2014, 10:46 PM
I'm working on a solution to fix this issue. Hope to finish this weekend!