Hi Adam,
I have tried two way to try to get the results I need.
I copied the code and it's displaying the Ids on screen however it's not displaying correctly.
Tried 1:
I added it to the change function since I know that if I update the record, it will dynamically show up.
I added:
public function change($form, & $filters, & $vals, & $crits, & $dont_hide, $rb) {
$gb = $this->init_module('Utils/GenericBrowser', null, $rb->tab);
$order = array();
$this->amount_of_records = Utils_RecordBrowserCommon::get_records_count($rb->tab, $crits, $admin, $order);
if ($limit === null && !$rb->disabled['pagination'])
$limit = $gb->get_limit($this->amount_of_records);
$records = Utils_RecordBrowserCommon::get_records($rb->tab, $crits, array(), $order, $limit, $admin);
if ($admin) $this->browse_mode = 'all';
if ($this->browse_mode == 'recent') {
$ret = DB::Execute('SELECT * FROM '.$this->tab.'_recent WHERE user_id=%d ORDER BY visited_on DESC', array(Acl::get_user()));
while ($row = $ret->FetchRow()) {
if (!isset($records[$row[$this->tab.'_id']])) continue;
$records[$row[$this->tab.'_id']]['visited_on'] = Base_RegionalSettingsCommon::time2reg(strtotime($row['visited_on']));
}
} else {
$this->set_module_variable('set_browsed_records',array('tab'=>$rb->tab,'crits'=>$crits, 'order'=>$order, 'records'=>array()));
}
if (isset($limit)) $i = $limit['offset'];
foreach ($records as $row) {
if ($rb->browse_mode!='recent' && isset($limit)) {
self::$browsed_records['records'][$row['id']] = $i;
$i++;
}
}
var_dump(self::$browsed_records);
It displays 6 ids (that all the records I currently have).
when I change the view from 10 records to 5, the values doesn't change.
When I refresh the module, it's now showing 5 ids, which is good.
When I go to the next page, the 5 ids are still showing and the last id is not displayed. (it should only show the 1 id).
when I output the var_dump in the file you recommended me to do, it does this no problem but again, I need it in the custom module.
Tried 2:
I have done what you have told me, I put it in the syncRecord function (same code above by the way)
on the first page, it shows me, on every record, display the ids on every record (changed back the view to 10 records by the way)
When I changed the view to 5, it still gives me the same result (display the ids on very record). When I refresh, the last id is mission (which is what I want because it should be on page 2)
when I go to page 2, it still displays the ids on the first page.
I don't think I'm missing anything important since I did copied all the logic from the function you told me (I cleaned it up on the custom module).
Please let me know what you think and what changes I need to make to display the correct record ids for each page.
thanks,
jjjj12212