CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 CSS of last record in a grid

Print topic Send  topic

Author Message
alfonso

Posts: 121
Posted: 08/23/2013, 10:08 PM

I want to put, only in the last record of a grid a stile like "last" to delete right margin. For example, the result should be like this:

<div class="column one-half">
First record
</div>
<div class="column one-half">
Second record
</div>
<div class="column one-half last">
Last record
</div>

Any idea?
View profile  Send private message
Lucius

Posts: 220
Posted: 08/24/2013, 1:08 PM

hi,

1st - place a Label control in the grid, where "last" should show.

2nd - calculate how many records this grid has (could be done on BeforeSelect), and then on BeforeShowRow do a check if current row is last. If yes, then print-out "last" to your label.

View profile  Send private message
alfonso

Posts: 121
Posted: 08/25/2013, 1:03 AM

Really the grid have always the same records: 3. Could you show me an example with code?. Thanks
View profile  Send private message
alfonso

Posts: 121
Posted: 08/31/2013, 1:58 AM

How can I know if it is showing the second record? I imagine if I put in BeforeShow:

If actual_record=2
label.value=last"
else
label.value=""
end if

The cuestion is that I don't know how to get the value of the actual record
View profile  Send private message
scarvello

Posts: 64
Posted: 08/31/2013, 5:59 PM

You can use jQuery filter to select last row of a table and then apply your custom css style.
Google for "select last table row with jQuery"
View profile  Send private message
alfonso

Posts: 121
Posted: 08/31/2013, 11:16 PM

I see, but the question is that I don't works with tables I works with divs and lists.

I think may be solved if there a way to know it the record is 1, 2 or 3. So I create tree css styles .1, .2, .3
View profile  Send private message
scarvello

Posts: 64
Posted: 09/01/2013, 12:51 AM

I have not tested but I think you can also filter any last child element.
Give a look here:
http://api.jquery.com/last-child-selector/
View profile  Send private message
alfonso

Posts: 121
Posted: 09/02/2013, 10:50 PM

That is the solution. Simply. and clear. Solved. Thanks a lot
View profile  Send private message
JessicaRobort

Posts:
Posted: 09/24/2013, 2:23 AM

solved
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.