[ 6 posts ]

jira

  • Username: jira
  • Joined: Mon Sep 06, 2010 11:16 am
  • Posts: 25
  • Offline
  • Profile

Resizable DataTable

Post Posted: Wed Aug 10, 2011 3:08 am
+0-
Hello,

I have a DataTable in a resizable Panel, but I cannot figure out how to resize the table when the panel is resized.

Bret Levy

  • Username: BretLevy
  • Joined: Tue Jan 05, 2010 9:56 am
  • Posts: 34
  • Location: Atlanta, GA
  • Offline
  • Profile
Tags:

Re: Resizable DataTable

Post Posted: Sun Aug 14, 2011 8:22 am
+0-
Using your data table object "DT", try:

DT.context.set ('width', ''+w+'px');
DT.context.set ("height", ''+h+'px');

Note that w and h are the desired height and width, respectively.

Hope that helps...

~~bret

jira

  • Username: jira
  • Joined: Mon Sep 06, 2010 11:16 am
  • Posts: 25
  • Offline
  • Profile

Re: Resizable DataTable

Post Posted: Mon Aug 15, 2011 1:01 am
+0-
That doesn't work.

I can actually resize the table with :

self.table.setAttributes({width: width + 'px'},true);
self.table.setAttributes({height: height + 'px'},true);

But that doesn't resize the columns, just some empty space is added to the table.

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile
Tags:

Re: Resizable DataTable

Post Posted: Mon Aug 15, 2011 11:45 am
+0-
Suggest you post a pastie link to your code so people can see what you have so far.

jira

  • Username: jira
  • Joined: Mon Sep 06, 2010 11:16 am
  • Posts: 25
  • Offline
  • Profile

Re: Resizable DataTable

Post Posted: Tue Aug 16, 2011 6:48 am
+0-
Hello,

I put the relevant portion of the code at http://pastie.org/2380705. It is nearly verbatim stolen from YUI example of Panel resizing.
My problem is to make the table in the panel resize together with the panel.
I can make the table resize, but not the columns in it.

Todd Smith

YUI Contributor

  • Username: stlsmiths
  • Joined: Thu Nov 05, 2009 10:03 am
  • Posts: 675
  • GitHub: stlsmiths
  • Gists: stlsmiths
  • IRC: t_smith
  • Offline
  • Profile

Re: Resizable DataTable

Post Posted: Tue Aug 16, 2011 7:04 am
+0-
The pastie code you provided doesn't show any DataTable definitions. We can't offer much help for what we can't see here !

You will probably have to do a lot of programming work to resize a DT in a resizable panel. The Resize utility cannot operate directly on the DT. The only way I can think of that may make this work is to (a) define resizable columns on the DT columndefs and see what comes out,
OR
(b) specify column definitions for the base Panel size (in column Defs using "width" property) and then on a resize event completely re-calculate each column def and re-create the entire DataTable, calling .destroy first.

There may be other ideas out there, but remember that DataTable is not an HTML Table where you can just set column widths as % and have the browser resize it. DataTable is a complex dynamic JavaScript object that can only do so much.

If you think about it for a minute, on a resize where should the space be made up? From which column? Do all columns get re-sized? What about data wrapping? These are a lot of important issues that would need to be addressed .... so it is not such a simple thing as re-sizing after a panel resize.

And since the 2.x version of YUI is now considered in "maintenance mode" don't expect a feature to be added, you'll most likely need to come up with a solution on your own or redesign your app.

Todd
  [ 6 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum