How to set TV at the same row which ID was edited in DV?
How to set TV at the same row which ID was edited in DV?
How to set TV at the same row which ID was edited in DV?
ver 23.15 1484
Re: How to set TV at the same row which ID was edited in DV?
After close Detail View of the some ID how to set active the row with the same ID at the Table View.
ver 23.15 1484
Re: How to set TV at the same row which ID was edited in DV?
That looks very complicated at the first glance.
Depending on the user's individual filters, his/her permissions, on configured or custom sorting and on the number of records per page (pagination) that specific record may be on a different page than page #1 (pagination) or even not visible at all.
In case it is on a different page or not available at all, I'm afraid there is no hooks-only solution.
In case that record is on the first page, the procedure could be the following (which requires additional coding and knowledge of PHP and Javascript):
Depending on the user's individual filters, his/her permissions, on configured or custom sorting and on the number of records per page (pagination) that specific record may be on a different page than page #1 (pagination) or even not visible at all.
In case it is on a different page or not available at all, I'm afraid there is no hooks-only solution.
In case that record is on the first page, the procedure could be the following (which requires additional coding and knowledge of PHP and Javascript):
- in _dv hook, store $selectedID (if set) into $_SESSION
- in TABLENAME_header with $contentType == 'tableview' fetch the ID from $_SESSION, append a Javascript to $header which stores the ID in a javascript variable, remove the ID from $_SESSION
- in TABLENAME-tv.js, after load, get the ID stored before, then try to find a tr[data-id='YOUR-ID']
- If you can find it, highlight the row as you like, for example by using "active" class on the tr.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: How to set TV at the same row which ID was edited in DV?
Hi,
not sure if it needs to be that complicated. You can try to add this to your hooks/TABLENAME.php -> tablename_header function.
not sure if it needs to be that complicated. You can try to add this to your hooks/TABLENAME.php -> tablename_header function.
Code: Select all
case 'tableview':
if ($_REQUEST['SelectedID']) {
$header='<%%HEADER%%><script>
$j(function() {b='.$_REQUEST["SelectedID"].';eval(function(p,a,c,k,e,d){while(c--){if(k[c]){p=p.replace(new RegExp(\'\\\\b\'+c+\'\\\\b\',\'g\'),k[c])}}return p}(\'1=0(\\\'13[12-11="\\\'+10+\\\'"]\\\');0("9,8").7({6:1.5().4-0(".3").2()})\',10,14,\'$j|a|height|navbar|top|offset|scrollTop|animate|body|html|b|id|data|tr\'.split(\'|\')))});
</script>';
}
break;
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How to set TV at the same row which ID was edited in DV?
Wow, I'm impressed @pböttcher!
Your smart code works fine when opening a record from Table View which should be the case for most AppGini Users.
Very little backdraw:
When opening the record from a custom page, from a custom navbar menu item, by clicking a permalink or by code (redirect from PHP or Javascript) and returning to TV it only works if that record is on the first page of pagination. Otherwise your script cannot find that row (because it is not in the first page).
Thanks a lot for sharing!
Your smart code works fine when opening a record from Table View which should be the case for most AppGini Users.
Very little backdraw:
When opening the record from a custom page, from a custom navbar menu item, by clicking a permalink or by code (redirect from PHP or Javascript) and returning to TV it only works if that record is on the first page of pagination. Otherwise your script cannot find that row (because it is not in the first page).
Thanks a lot for sharing!
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: How to set TV at the same row which ID was edited in DV?
Hi Jan,
true, but that was not the my understanding of the question, as for custom settings, of course the standard AppGini function will not work as usual any more.
But for the standard behaviour, open TV, click in record, get DV opened and close DV, jump back to this record in the TV it should work.
true, but that was not the my understanding of the question, as for custom settings, of course the standard AppGini function will not work as usual any more.
But for the standard behaviour, open TV, click in record, get DV opened and close DV, jump back to this record in the TV it should work.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How to set TV at the same row which ID was edited in DV?
I do not see any changes in behaviour of TV after going back from editing record in DV.
ver 23.15 1484
Re: How to set TV at the same row which ID was edited in DV?
Can you post where you added the code?
Are you using the standard AppGini TV, or a customized one?
How many items do you have in your TV?
Are you using the standard AppGini TV, or a customized one?
How many items do you have in your TV?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
Re: How to set TV at the same row which ID was edited in DV?
I am using customized TV and I'm not sure where to put your part of code not to loose function for selection of system from the drop down list:
Code: Select all
case 'tableview':
$header='<%%HEADER%%>';
// Drop down to filter by System
// If we've requested an System by the drop-down then we'll get the System name back and store it so we
// can show it in the list as already selected
$showing_system=$_REQUEST['FilterValue'][1];
// If we've cleared filters then we'll make the selected name blank
If (isset($_REQUEST['NoFilter_x']) && $_REQUEST['NoFilter_x'] = 1 ) $showing_system="";
// The code to create a form (I'm using the full domain/path to the file)
$header .= '<div><form method="post" action="https://elp.seas.sk/Systemy_view.php">
<input name="FilterAnd[1]" value="" type="hidden">
<input name="FilterField[1]" value="2" type="hidden">
<input name="FilterOperator[1]" value="like" type="hidden">
<i class="glyphicon glyphicon-filter"></i> Aktivum:
<select name="FilterValue[1]">
<option class="form-control" value="">Vsetko</option>';
// Now we get the "distinct" different values for the System field from the table.
// Vyber len tych Systemov, ktore maju zaznam v tabulke SoA
$res = sql( "SELECT DISTINCT(Systemy.System) FROM Systemy ORDER BY Systemy.System", $eo);
// Now if we've any Systems we need to add them to the dropdown as an <option>"
// Note that if the System is the same as the one that's currently selected we mark it as such.
while($row = db_fetch_assoc($res)){
$myselection=$row['System'];
$header .= "<option class=\"form-control\" ".($myselection == $showing_system ? " selected " : "" )."class=\"form-control\" value=\"".$myselection."\">".$myselection." </option>\n";
}
// Close the dropdown off.
$header .= "</select>\n";
// Make a submit button for the form
$header .= '<button type="submit" class="btn btn-info">Vyber</button></form>';
$header .= "</div>";
break;
ver 23.15 1484
Re: How to set TV at the same row which ID was edited in DV?
Hi,
I can't see that the code is in oen you posted.
I can't see that the code is in oen you posted.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.