Update view on menu action

26 views
Skip to first unread message

Anderson Florencio

unread,
Dec 22, 2015, 9:43:50 AM12/22/15
to ZnetDK
Dear Pascal, in the case of a framework to develop multi-user systems would not be interesting recharge the view whenever a menu is activated? For if a User is already preloaded with the screen and other User update some information that view, will not be seen immediately by the previous User, unless the same refresh the page.

Anderson Florencio

unread,
Dec 22, 2015, 12:19:47 PM12/22/15
to ZnetDK
Dei uma olhada no código e vi que o framework já possui essa capacidade, basta modificar o valor do parâmetro CFG_VIEW_PAGE_RELOAD de false para true.

Pascal Martinez

unread,
Dec 22, 2015, 4:53:40 PM12/22/15
to ZnetDK
Hello Anderson,

Only if you use the 'office' page layout, you can refresh the datatable content each time the view is displayed, by handling the 'initview' event like shown in the example below:

$('#zdk-office-menu').on('zdkofficemenuinitview', function(event, parameters){
           
if (parameters.menuItem === 'myview') {
                $
('#mydatatable').zdkdatatable('refresh');
           
}  
 
});

In this case, you can keep the CFG_VIEW_PAGE_RELOAD parameter value to TRUE.

Regards,

Pascal MARTINEZ

Pascal Martinez

unread,
Dec 23, 2015, 7:54:16 AM12/23/15
to ZnetDK
Hello Anderson,

In addition, you can add a refresh button to the ZnetDK action bar to refresh on demand the datatable content.


For that, you just have to add a button with the "zdk-bt-refresh" class into your zdkactionbar element:

<!-- Actions bar -->
 
<div class="zdk-action-bar" data-zdk-dialog="demo-crud-dlg" data-zdk-datatable="demo-crud-table">
 
<!-- Action buttons -->
 <button class="zdk-bt-refresh"></button>
 
<button class="zdk-bt-add">New</button>
 
<button class="zdk-bt-edit">Edit</button>
 
<button class="zdk-bt-remove" data-zdk-action="democrudctrl:remove">Remove</button>
 
</div>

The datatable set for the 'data-zdk-datatable' attribute is then automatically refreshed when clicking on the refresh button.

Regards,

Pascal MARTINEZ

Anderson Florencio

unread,
Dec 23, 2015, 10:21:37 AM12/23/15
to ZnetDK
Initially it had changed the CFG_VIEW_PAGE _RELOAD parameter value from false to true, but I use the classic menu and was working for some views only, in other showed no content, then settle back parameter to false. And studying the code I found exactly what you talked about the refresh button and added in my action bars and it worked good ... Thank you for the help and sorry for speaking in Portuguese on the other POST .. hahaha, I forgot! !
Reply all
Reply to author
Forward
0 new messages