Welcome Guest, Not a member yet? Register   Sign In
Have to press F5 everytime to see the updates on a view [fixed]
#1

[eluser]hyperfire[/eluser]
Something strange is happening here.
I have set-up a simple admin crud, and it all seems to work fine, but now, every time I make a change to a record, I have to press F5 to show the updated values on the list and on the edit form, to see that the changes have been applied.

Just weird...when I submit changes, the db is updated as expected, when user is redirected from edit form back to main list after update, the old value still there, pressing F5, show the 'real' value just fine.

Any clues?
#2

[eluser]Randy Casburn[/eluser]
Your application is showing cached results. Either CI caching is returning cached results or your DB cache is returned a cached query result set. I would start there and see what you find.

Hope that helps,

Randy
#3

[eluser]Developer13[/eluser]
Or your logic is a bit out of order. Perhaps the data for your view is being gathered before the actual database update / insert occurs.
#4

[eluser]Rey Philip Regis[/eluser]
[quote author="Developer13" date="1229391903"]Or your logic is a bit out of order. Perhaps the data for your view is being gathered before the actual database update / insert occurs.[/quote]

I think this is the exact answer to the problem.
#5

[eluser]Jelmer[/eluser]
It might also be a browser cache problem, which you could fix by adding:
Code:
$this->output->set_header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
$this->output->set_header("Cache-Control: no-store, no-cache, must-revalidate");
$this->output->set_header("Cache-Control: post-check=0, pre-check=0", false);
$this->output->set_header("Pragma: no-cache");
That should prevent any caching and reload your pages every time.
#6

[eluser]hyperfire[/eluser]
Thank you all for the tips! All said here had been tested without success.
The issue was fixed removing the custom Pagination.php from config dir.
The contents of that file:

Code:
<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

    $config['per_page']         = '10';    
    $config['first_link']         = '« First';
    $config['last_link']         = '    Last»';
    $config['next_link']         = ' Next ›';
    $config['prev_link']         = '‹ Prev';
    $config['full_tag_open']     = '<div class="pagination"><ul>';
    $config['full_tag_close']     = '</ul></div>';
    $config['first_tag_open']     = '<li class="previous-off">';
    $config['first_tag_close']    = '</li>';
    $config['last_tag_open']     = '<li class="next-off">';
    $config['last_tag_close']    = '</li>';
    $config['cur_tag_open']     = '<li class="active">';
    $config['cur_tag_close']     = '</li>';
    $config['num_tag_open']     = '<li>';
    $config['num_tag_close']     = '</li>';
    $config['prev_tag_open']     = '<li class="previous">';
    $config['prev_tag_close']     = '</li>';
    $config['next_tag_open']     = '<li class="next">';
    $config['next_tag_close']     = '</li>';
    
?&gt;

Now, everytime I need a pagination, I just paste something like this all arround my controllers:

Code:
$config['per_page']         = '10';    
        $config['first_link']         = '&laquo; First';
        $config['last_link']         = '    Last&raquo;';
        $config['next_link']         = ' Next &rsaquo;';
        $config['prev_link']         = '&lsaquo; Prev';    
        $config['full_tag_open']     = '<div class="pagination"><ul>';
        $config['full_tag_close']     = '</ul></div>';
        $config['first_tag_open']     = '<li class="previous-off">';
        $config['first_tag_close']    = '</li>';
        $config['last_tag_open']     = '<li class="next-off">';
        $config['last_tag_close']    = '</li>';
        $config['cur_tag_open']     = '<li class="active">';
        $config['cur_tag_close']     = '</li>';
        $config['num_tag_open']     = '<li>';
        $config['num_tag_close']     = '</li>';
        $config['prev_tag_open']     = '<li class="previous">';
        $config['prev_tag_close']     = '</li>';
        $config['next_tag_open']     = '<li class="next">';
        $config['next_tag_close']     = '</li>';

I donĀ“t like all that dup code, but it works.
Perhaps because of the custom items inside the template?
No ideas.




Theme © iAndrew 2016 - Forum software by © MyBB