Page 1 of 1

List-View - column width, change default

PostPosted: Thu Feb 19, 2009 10:07 am
by nibra2000
Steve,
Thank's for a great product, I'm starting to develope some very nice tools with this library.

My question involves changing the default column width while in list view.
I'm sure this is documented in the forum somewhere, but I am finding some of the posts conflicting...some say you have to edit the library, others say it may be configurable via an .ini file.... I'd much rather accomplish this via an .ini file, since it makes upgrading xataface a while lot nicer... Either way is fine.
My coding experience is moderate, but ambitious...

I have a couple of columns where the information generated is broken into two llines - likely for purposes of keeping the view compact, but in my case i would like the width increased for particular columns.. for example - I have a column with called "owner", which is populated with peoples names, this column is populated with a __sql__ query from another table in valuelists.ini -- here is the query I have:
---begin code ----begin code---
[Owner]
__sql__ = "SELECT name_id, concat(last_name, ', ', first_name) FROM people ORDER BY last_name" ...

---end----end----

So what I am trying to accomplish is getting the 'last_name' & 'first_name' to appear on the same line while in list-view, rather than separate lines, and it seems to me like problem is the column width causing the results to get a line break -- perhaps its something else (the 'concat') ?

.
Thank's
-B

PostPosted: Thu Feb 19, 2009 10:23 am
by shannah
There are likely many ways to do this, as it is a stylesheet issue. Here is one way that should work:

Use the xxx__renderCell() method on the field that you want to ensure that it stays on one line. E.g. if the field that we're working on is called 'full_name' you would do the following:

Code: Select all
function full_name__renderCell(&$record){
    return '<div style="white-space:nowrap">'.$record->display('full_name').'</div>';
}


The things to notice here is that I wrap the cell content in a <div> tag and use the CSS 'white-space' property to force it not to wrap.

(This method goes in the table delegate class).

-Steve

PostPosted: Thu Feb 19, 2009 10:32 am
by nibra2000
Where should I do this - i.e. what location/ file does this go in ?

If its a .css, am I creating a new .css file - or am editing the main library ?

I guess I need to know how to override the default .css.
I don't know style sheet syntax, so its probably going to take some tinkering...


-B

PostPosted: Thu Feb 19, 2009 10:45 am
by shannah
This goes in the delegate class for the table in question. Most customizations for your applications will be done in the delegate class so it's worth getting acquainted with them (check the getting started tutorial and other documentation in the wiki on this subject).

You shouldn't need to modify Xataface at all.

PostPosted: Thu Feb 19, 2009 11:56 am
by nibra2000
Will do,
I'll check things out from that angle.
thanks for the help.

-B

PostPosted: Tue Feb 24, 2009 7:53 am
by nibra2000
Hi Steve,
I'm trying to get this to work, but with little success.
I have two fields where I am trying to remove the line break when in list view.
Fields are: 'owner' & 'projects'.
Here is the code I am adding to the end of ApplicationDelegate.php,
located in the 'conf' directory in the root of my application
--begin code---
function owner__renderCell(&$record){
return '<div>'.$record->display('owner').'</div>';
}

function projects__renderCell(&$record){
return '<div>'.$record->display('projects').'</div>';
}
?> (this closing ?> php tag was existing, not added, just to show where I am putting it)

---end---

I'm learning how ApplicationDelegate methods are pretty much everything to Xataface development.

Thank's
-B

PostPosted: Tue Feb 24, 2009 8:45 am
by shannah
These methods go in the table delegate classes not the application delegate class. The table delegate classes pertain to a particular table. The application delegate class pertains to application-wide properties.

Re:

PostPosted: Mon Jan 28, 2013 2:44 pm
by jerryevo
Code: Select all
function full_name__renderCell(&$record){
    return '<div style="white-space:nowrap">'.$record->display('full_name').'</div>';
}


This disables wrap but puts text in bottom of the cell. How to center it?

Re: List-View - column width, change default

PostPosted: Tue Jan 29, 2013 9:58 am
by shannah
You'll have to tinker with the CSS padding and margin until it looks right.