PDA

View Full Version : After addding new document, how to auto-refresh view?



rvoith
14 Feb 2008, 2:03 AM
When I add a new document, the view isn't refreshed accordingly. Of course I can use the refresh-button at the Search-bar at the bottom, but that could perhaps be avoided if I code something? BTW, I've seen several threads in this forum, discussion this topic, whithout a clear advice on how to fix though.

martin meijer
14 Feb 2008, 4:51 AM
When I add a new document, the view isn't refreshed accordingly. Of course I can use the refresh-button at the Search-bar at the bottom, but that could perhaps be avoided if I code something? BTW, I've seen several threads in this forum, discussion this topic, whithout a clear advice on how to fix though.

I agree with rvoid. I know that Rich and Jack are very busy to implement new stuff and improve ext.nd, but maybe there is a simple script available that can be implement quickly for the time being?

jratcliff
14 Feb 2008, 6:14 AM
Hmm, let me look into a few things. You are right though, it doesn't look like we give an easy way to trigger a view refresh from a document in another tab. However, we do have a 'refresh' method for an Ext.nd.UIView that will do what you want. So I'll see if there is a quick script that can be whipped up for now that can be called from a document (or probably after a document is saved & closed)

~Jack R.

RWaters
14 Feb 2008, 9:52 AM
Something like


window.parent.YourApp.ui.uiView.refresh();

Zakaroonikov
14 Feb 2008, 12:56 PM
When I add a new document, the view isn't refreshed accordingly. Of course I can use the refresh-button at the Search-bar at the bottom, but that could perhaps be avoided if I code something? BTW, I've seen several threads in this forum, discussion this topic, whithout a clear advice on how to fix though.

I guess the other question is even after a refresh you may not see the newly created document because it might not be on the first page (which a refresh will show you).

martin meijer
15 Feb 2008, 12:14 AM
Something like


window.parent.YourApp.ui.uiView.refresh();


Where should I place this code? (in what event on the form that is submitted or the page)

jratcliff
15 Feb 2008, 6:10 AM
Well, I just tried this code from an action button and it refreshed the view that was loaded in the first tab.



var gridPanel = window.parent.ExtndApp.ui.tabPanel.findById('xnd-grid-panel');
var grid = gridPanel.items.items[0];
var bbar = grid.getBottomToolbar();
bbar.store.load();


Note that "ExtndApp" is the name/variable I used to define the app in main.html, so if you have changed that to something else you will need to do the same in the 'gridPanel' line.



var ExtndApp = function() {
return {
init : function(){
this.ui = new Ext.nd.DominoUI({
uiOutline : {outlineName: 'mainOL'},
uiView : {viewName: 'f1', viewTitle: 'A Flat View Example', showSearch: 'true'}
});
} // init
} // return
}();
Ext.onReady(ExtndApp.init, ExtndApp, true);


Ok, so now we need to figure out

1 - how to save the doc first
2 - after the save to execute the above code
3 - and finally, to remove this tab

jratcliff
15 Feb 2008, 6:22 AM
Rich, it turns out that this code won't work if the user has changed the initial view that was loaded. We only set uiView when DominoUI is created and don't update it when a different view is clicked on from the outline.


Something like


window.parent.YourApp.ui.uiView.refresh();

RWaters
15 Feb 2008, 10:48 AM
Good point about the UIView reference, we'll need to look into making sure that stays updated. Just wanted to point out a slightly simpler way to get ahold of the grid that is more generic and doesn't require you to know the application variable ahead of time.
So instead of:


var gridPanel = window.parent.ExtndApp.ui.tabPanel.findById('xnd-grid-panel');

Try:


var gridPanel = window.parent.Ext.getCmp('xnd-grid-panel');


The component manager is one of the really great enhancements in Ext 2.x