List-View - column width, change default

A place for users and developers of the Xataface to discuss and receive support.

List-View - column width, change default

Postby nibra2000 » Thu Feb 19, 2009 10:07 am

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
nibra2000
 
Posts: 15
Joined: Wed Feb 04, 2009 10:04 am

Postby shannah » Thu Feb 19, 2009 10:23 am

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby nibra2000 » Thu Feb 19, 2009 10:32 am

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
nibra2000
 
Posts: 15
Joined: Wed Feb 04, 2009 10:04 am

Postby shannah » Thu Feb 19, 2009 10:45 am

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.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby nibra2000 » Thu Feb 19, 2009 11:56 am

Will do,
I'll check things out from that angle.
thanks for the help.

-B
nibra2000
 
Posts: 15
Joined: Wed Feb 04, 2009 10:04 am

Postby nibra2000 » Tue Feb 24, 2009 7:53 am

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
nibra2000
 
Posts: 15
Joined: Wed Feb 04, 2009 10:04 am

Postby shannah » Tue Feb 24, 2009 8:45 am

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.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re:

Postby jerryevo » Mon Jan 28, 2013 2:44 pm

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?
jerryevo
 
Posts: 16
Joined: Sun Jan 06, 2013 1:30 pm

Re: List-View - column width, change default

Postby shannah » Tue Jan 29, 2013 9:58 am

You'll have to tinker with the CSS padding and margin until it looks right.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 6 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved