CodeIgniter Forums

Full Version: customized pagination using pagination class
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]rangana[/eluser]
Hi Guys,

I'm just starting with CI, I'm developing a application here i want to achieve this functionality

* Display a user interface to a person with pagination enabled.
* those pagination items must have a link in them (for each item),so when i click one of them
another user interface will be loaded and i have the opportunity to enter the data
to the selected item.
* then after he successfully modified the data, it should be returned to the previous
user interface(pagination interface) there the entry i edited must not be displayed and
it must be not shown in the list now!

can i achieve this using existing pagination class? need a big help with this guys?
please help me out!

regards,
Rangana

El Forum

[eluser]georgeedwards[/eluser]
Not sure why you would NOT want to display something after editing it - because this surely counts as a delete?

But I do the following, in pagination situations where I need an edit/update facility (this is in the view):

Code:
<?php if ($items) : ?>
     <table>
          <tr><th>ID</th><th>Title</th><th>Options</th></tr>
          &lt;?php foreach ($items as $item) : ?&gt;
          
               <tr>
                    <td>&lt;?= $item['id'] ?&gt;</td><td>&lt;?= $item['title'] ?&gt;</td><td><a href="/controller/edit_action/&lt;?= $item['id'] ?&gt;" target="_BLANK">Edit</a></td>
               </tr>
          
          &lt;?php endforeach; ?&gt;
     </table>
&lt;?php endif; ?&gt;

This way then you can build an edit view that is called from the /controller/edit_action method, and accepts the ID of the item you wish to edit as URI segment 3.

_BLANK will obviously open this in a new window.

Does this help at all?