Is there a possibility to open the grid with a “saved grid”?
Save Grids on username
Checked Use rules
New rule button
Name: user (is the reference of the rule)
Label: User
Variable name: [user_login] (global variable with user login)
Add button
Thank you for your answer. I know how to save grids. I have a field ‘active’. I always want to open the grid with only the active records, but with the possibility to show the ‘incative’ fields also with a filter. I thought to do it with the saved grid option.
I think in your filter you can add the field Status default Active. So user can changes the status to Inactive.
Could you explain a bit more? My users use the grid often. If they have to change the layout everytime, it is too much work. Maybe try to save the layout in a global variable or so? Besides that, I’d like to make a ‘mobile’ layout, that automatically appears on a mobile device.
I found a kind of solution:
echo
"
<script type=‘text/javascript’>
function openSavedGrids() {
scBtnSaveGridShow(‘cons’, ‘Y’, ‘top’);
}
window.onload = openSavedGrids;
setTimeout(function(){
nm_select_grid(‘98c308a9f5794a3ce522890b30611e279’, ‘Client => Test’);
}, 1000);
</script>
";
I can’t execute them direct after each other for some reason. So that’s why I do it with the timer.
- Does somebody knows where I can find the whole javascript code from the function? So I can save the code in the database and execute it dynamicly?
- Is there a better solution for this?
why not just use a search section. Add a radiobutton in the search with values 1 and 0 for active and non-active. Enable the 'onchange submit ’ on the same page to reload new result after clicking radio button. You can even use a refined filter with the same result.
Hola Zaz, muchas gracias por tu código!
Lo estuve probando y me funcionó mejor haciendo lo siguiente:
echo "
<script type='text/javascript'>
function openSavedGrids() {
scBtnSaveGridShow('cons', 'Y', 'top');
setTimeout(function() {
nm_select_grid('e897324449dc0189f5d32b7d0f27357c', 'Filtro guardado => Pendientes');
scBtnSaveGridHide('top');
}, 0.0001);
}
window.onload = openSavedGrids;
</script>
";
En este caso scBtnSaveGridShow abre la ventana de los filtros guardados, “nm_select_grid(‘e897324449dc0189f5d32b7d0f27357c’, ‘Filtro guardado => Pendientes’);” selecciona el filtro guardado y “scBtnSaveGridHide(‘top’);” cierra la ventana. No funciona sin la función setTimeout, pero la puse con un valor bajo para que casi no lo perciba el usuario.
Saludos!