Welcome Guest, Not a member yet? Register   Sign In
how to make the table rows into links?
#1

[eluser]paigenotfound[/eluser]
hi again, im having trouble making my table rows into links. the table will be populated with first name and last name. and click on the first name and last name will bring them to their corresponding user profile.

is there a way to make the rows wihtin my table into clickable links in ci? i tried the js onClick event on the <tr> tag but cant seem to make it work. wrapping the whole row with <a></a> wont do also. hope someone can help me here. thank you in advance.
#2

[eluser]n0xie[/eluser]
Wrap the inner content of the TD in a <a > ?
#3

[eluser]paigenotfound[/eluser]
i mean something like this

Code:
echo '<a href='.base_url().'>cid.'>';
echo '<tr>';
echo '<td>';
echo ucwords($row->lname).',' ;
echo '</a>';
echo '</td>';
echo '<td>';
echo ucwords($row->fname);
echo '</td>';
echo '</tr>';
echo '</a>';
#4

[eluser]rogierb[/eluser]
ehhh... right... You gave yourself the answer

<b>Edit</b> CI keeps f-ing up the code I post....
Code:
a href=base_url().memberprofile/.$row->user_id
#5

[eluser]John_Betong[/eluser]
[quote author="paigenotfound" date="1257276904"]i mean something like this

Code:
echo '<a href='.base_url().'>cid.'>';
echo '<tr>';
echo '<td>';
echo ucwords($row->lname).',' ;
echo '</a>';
echo '</td>';
echo '<td>';
echo ucwords($row->fname);
echo '</td>';
echo '</tr>';
echo '</a>';
[/quote]
&nbsp;
&nbsp;
Why use tables? Try this: &nbsp; this &nbsp; instead.
&nbsp;
&nbsp;
&nbsp;
#6

[eluser]paigenotfound[/eluser]
the reason why i use table is because the contents will be populated by a db query which will list all users and some of their info.

the list will become quite large so i need to properly format it using a table. what i would like to achieve is to make the whole table row a clickable link which will forward to the corresponding user profile.

thank you all for your time.
#7

[eluser]Colin Williams[/eluser]
Not so sure a whole table row can be hyperlinked, but I may be wrong. The other option is to do some javascript that drills <tr> clicks down to the first child <a>

Code:
// jQuery
$('.data tr').click(function(){$('a', this).eq(0).click()});

Some browsers might not fire the click event for <tr> though, so you might need to get even trickier, using <td> clicks instead (td > parent tr > first a)
#8

[eluser]pistolPete[/eluser]
Have a look at Clickable table rows using Jquery.
#9

[eluser]John_Betong[/eluser]
&nbsp;
Here we go, version: 002 with just CSS:

http://localhost/downloads/codeigniter/c...ver_02.php
&nbsp;
&nbsp;
&nbsp;




Theme © iAndrew 2016 - Forum software by © MyBB