PDA

View Full Version : Facing a strange problem



mohit.katiyar
10 Jan 2008, 1:33 AM
Dear All,
I'll try to explain the problem im facing in an implementation of Ext.nd. I have attached a screenshot as well to explain the issue.

In my application, there's a view that displays multiple categorized columns. And the action bar contains actions to create new documents. The view displays different kinds of parent & response documents.
Referring to the attached screenshot, the first column displays the clients, 2nd column displays the site documents and the third column displays the Supply points.
Among these documents,
The 'client' is a parent document
The 'supply' document is a response to the 'client', and
The 'supplypoint' is a response to the 'site' document.
The creation of response documents is dependent on the information stored in its parent document.

Now I am trying to implement a functionality where the user can select any document displayed in the view and click on the options available in the action bar. For e.g., if a user selects a particular 'Client' document and clicks on New 'Site', a new Site form is composed. Similarly, if a user selects a specific site and clicks on New Supplypoint, a new document is composed.

This functionality is working for the default view (in our case, Main View) that is displayed when the application is accessed and the actions work absolutely fine.
But the problem occurs when I select/open some other view from the outline menu and then click on the actions to compose new documents. There are 2 scenarios that cause a problem.

1. If I open the main view and select a client document and create a new site, the new document is created for the selected client. And then if I open some other view and select any other client and try to create a new site, a new document is created but it contains information of the client selected previously in the main view - whereas it should contain information of the currently selected client document. I fail to understand the reason behind this anomaly.

2. In the other scenario, after opening the application url, if I open some other view (other than the default), the action buttons dont work at all.

I am really unable to understand the reasons for this peculiar behaviour.
I'll be really grateful if anyone can help me out with this issue.

RWaters
10 Jan 2008, 9:27 AM
1. What is the code behind your actions? By default we don't provide a way to have the create new document know what the selected documents are, my thought is that this code may be off.

2. I'm not able to reproduce this issue, switching between views all the actions still work, again can you dig up the JavaScript code behind these buttons?

mohit.katiyar
10 Jan 2008, 10:22 PM
Hello Rich. Thanks for your reply.
I have also attached 2 screenshots that can be of some help.

The code behind the action to create a site is as below:


//Calls the function to compose a New Site form as a response to the selected Client
Ext.onReady(function() {
var frm="";
var row = this.ui.uiView.grid.selModel.getSelected();
if (row==null)
{
Ext.MessageBox.alert("Error","Select a client first please");
return false
}
var node = row.node;
var Docunid = node.attributes.getNamedItem('unid');
var tdoc = new Ext.nd.Document({unid:Docunid.value});
setTimeout("afterTimeOut()",1250);
});
//End of function to compose a New Site form as a response to the selected Client

The afterTimeOut() function is defined in the jsheader of main.html and is as follows:


//Compose the Site(Response to CLIENT form) on click of the New->Site action button.
function afterTimeOut() {
var row = this.ui.uiView.grid.selModel.getSelected();
var node = row.node;
var Docunid = node.attributes.getNamedItem('unid');
if (FormName!="CLIENT")
{
Ext.MessageBox.alert("Error","Select a client first please");
}
else
{
var pathname = window.location.pathname;
var temp=this.ui.uiView.openForm('Site',pathname.substring(0,(pathname.lastIndexOf('.nsf')+5))+'SUPPLY_SITE?OpenForm&ParentUNID='+Docunid.value)
}
}
// End Compose the Site(Response to CLIENT form) on click of the New->Site action button.

Similarly for the action to create a supplypoint, Im calling a function defined in main.html that displays a dialog box containing a list of available supplypoints.

I've also tried an alternate scenario where another view is displayed when the url is accesed. In this case too, the actions work only when accessed from the default view. However, if the user clicks on any actions in the default view (thereby somehow caching the information), and then moves over to some other view and then clicks on any actions, they work but the form thats displayed doesnt contain the correct parent information.
So my initial gut feeling was that even when some other view is opened, the Datastore still refers to the view loaded by main.html.
But im just speculating..
Please feel free to let me know if I can provide more information.
I really appreciate all your help.
Warm regards,
Mohit.