Welcome Guest, Not a member yet? Register   Sign In
the Table formatting library
#1

[eluser]yello[/eluser]
Hey there...

I am generating an html table using the Table library of CI and I was wondering if it would be possible to make something like this with it:

Everything in the first column of the table has a <a> tag which links to the query result id.

Right now all it does is parse the data... I don't know how to add custom things for each row/column.

Please help! Smile

Thanks!!
#2

[eluser]sophistry[/eluser]
addrow(), anchor().
#3

[eluser]yello[/eluser]
Hi sophistry,

I think you did not get what i meant to do.

Each element in the rows in the table contains a unique $id... I want to add a cell at the end of the row with so I can have a delete button which links like this: /element/delete/$id

I don't only want one delete button, I want one for each row with the correct $id

Can you help me?
Thanks!!
#4

[eluser]sophistry[/eluser]
post code.
#5

[eluser]yello[/eluser]
the view:

Code:
&lt;? $this->load->view('dashboard/menu'); ?&gt;

<div id="CONTENT">
    <h2>Client Pings</h2>
    <div id="TEXT">
    <p><b>Il est prĂ©sentement: &lt;?=date("Y-m-d H:i:s");?&gt;</b></p>
    <p>
    &lt;?
    echo $this->table->generate($pings);
    ?&gt;
    </p>
    </div>
</div>

&lt;? $this->load->view('dashboard/footer'); ?&gt;

the controller:
Code:
function pings()
    {
        $this->load->library('table');
        $pings = $this->db->query("SELECT * FROM `clientPing` ORDER BY `time` DESC LIMIT 100");

        if ($pings->num_rows() > 0)
        {
            $data['pings'] = $pings;
            $this->load->view('dashboard/pings', $data);
            
            
        }
    }
#6

[eluser]sophistry[/eluser]
yes, you have to *build* the links row by row out of your input object $pings. so in your controller you need to use the addrow() method of the table class and pair it with the anchor function (or hard code href tag if you like it that way).

cheers.




Theme © iAndrew 2016 - Forum software by © MyBB