Forums

paginator list problem,

tomkat 15 Oct, 2015
Hi, I've got CC V5 displaying data from 3 related tables with where statement, List is displayed according to param getting from link, from another CC V5 list, which got links with dynamic params. Params are catched via where statement:
<?php 
// where $var is an string
$var = JRequest::getVar('nr','', 'get');
$var = htmlspecialchars($var);
$dbo = \GCore\Models\nfs2::getInstance()->dbo;
$var = $dbo->quote($var);
return array (":model.field = {$var}");
?>

all working fine, till you try to change number of record displayed: ex from 30 to 10. In debug got empty Where statement which cose the problem
WHERE model.field = ''

But have no idea , how to solve this

Also got same problem when you submit search query.

Also not sure how to use in List -> Settings -> Stored Fields box, mightbe that would be the solution.
tomkat 15 Oct, 2015
sorry I was not clear, what ithe problem is, When you try to change amount of record displayed, or when you submit search query you get empty list (which is not true), but when you hit 'backspace' button you've got proper list same for pagination, as for search result, and where statement is filled with proper data.
tomkat 23 Oct, 2015
OK,

so will answer myself🙂 Hope that helps to someone.
will give you the clue how relations are set in my situation. First list displays records, related to second list by particular parameter. Wanted to stay in second list narrowed for the choosen parameter from the first list, when browsing and searching through second list records.

for the first problem , to have any list after using search on second list,was easy to add for condition box just
<?php
if (isset( $_GET['param'])){
$var = JRequest::getVar('param','', 'get');
$dbo = \GCore\Models\MODEL_ID::getInstance()->dbo;
$var = $dbo->quote($var);
return array (":MODEL_ID.field = {$var}");
}
else {
return false;
} ?>

but having set like that, search function searches through all records, so i set the fltr on same method but in Front list/Table/header
<?php
if (isset( $_GET['param'])){
$var = JRequest::getVar('param','', 'get');
$var = htmlspecialchars($var);
}
else {
$var = NULL;
} ?>
then in filter
<input type="hidden" name="fltr[MODEL_ID][field]" class="form-control A" value=<?php echo '"'.$var.'"'; ?> />

Then it was almost done, but when you use search function, filter value was stored in browser session i think ... as the only way to reset filter was to clean the browser cache. But searching through forum found that 'srch=' reset search params, so tried 'fltr=' and yes that reset filter params. So, when in the link of first list you add at the and
?param={MODEL_ID.field}&srch=&fltr=
that finaly do the trick.

Hope that helps to someone

one more, things went faster, when i've used
<?php
var_dump($this->data);
?>
in pre display processing box in front list / setting
This topic is locked and no more replies can be posted.