Column names repeated on end of the list.

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

Column names repeated on end of the list.

Postby Gwynnbleid1 » Tue Oct 30, 2012 3:24 pm

Hi. I was asked by my users if I can add column names also on the end of the list view. Is it possible ?
Gwynnbleid1
 
Posts: 31
Joined: Thu Sep 20, 2012 3:02 pm

Re: Column names repeated on end of the list.

Postby shannah » Tue Oct 30, 2012 3:51 pm

Do you need to do it dynamically or are there just some additional calculated columns you want to include?

Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Column names repeated on end of the list.

Postby Gwynnbleid1 » Tue Oct 30, 2012 11:27 pm

shannah wrote:Do you need to do it dynamically or are there just some additional calculated columns you want to include?

Steve

I I dont wont to add columns. I just want to repeat column names at the bottom. Like this:


Table A:

ColumnA ColumnB ColumnC
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
data1 data2 data3
ColumnA ColumnB ColumnC

As you can see if there is lot of rows then repeated column name in bottom would help you keep track of where you are.
Data in table in question consist mainly of numbers.
Gwynnbleid1
 
Posts: 31
Joined: Thu Sep 20, 2012 3:02 pm

Re: Column names repeated on end of the list.

Postby shannah » Wed Oct 31, 2012 7:38 am

The easiest way to do this would be using Javascript (jquery) to copy the thead of the table and insert it into a tfoot in the table.
e.g.
Code: Select all
var $thead = jQuery('#result_list thead').clone();
var $tfoot = $('<tfoot>');
$tfoot.append($thead.children());
jQuery('#result_list').append($tfoot);


Or something like this. (This actual code is untested).

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Column names repeated on end of the list.

Postby Gwynnbleid1 » Wed Oct 31, 2012 7:46 am

I tried to add it in Dataface_List_View.html file and got: Undefined variable: jQuery
So the place isn't ok for this code. Can you suggest a place to add this ?
Gwynnbleid1
 
Posts: 31
Joined: Thu Sep 20, 2012 3:02 pm

Re: Column names repeated on end of the list.

Postby shannah » Wed Oct 31, 2012 7:55 am

Ahh.. In 1.3.x and earlier, jQuery is included only where needed. I guess in list view it isn't included yet.
In 2.0 with the g2 theme it is always included.

So for 1.3.x, you can do this in two ways.
In your block, include both jquery and your script. Jquery is located in js/jquery.packed.js.
Or you could use the Javascript tool (inside your block also).

e.g. In your delegate class (application delegate for all tables or table delegate for particular table)
Code: Select all
function block__before_result_list(){
    echo '<script src="'.htmlspecialchars(DATAFACE_URL.'/js/jquery.packed.js').'"></script>';
    echo <script src="'.htmlspecialchars(DATAFACE_SITE_URL.'/js/myscript.js').'"></script>';
}


Or using the Javascript tool,
Code: Select all
function block__before_result_list(){
    Dataface_JavascriptTool::getInstance()
        ->import('myscript.js');
}

Then in your script you could use the Javascript tool's require directive to make it "require" jquery.
In js/myscript.js
Code: Select all
//require <jquery.packed.js>
.. the rest of my javascript.


-Steve
--
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 19 guests

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