PDA

View Full Version : [CLOSED] Window fails to appear



rgraham
May 26, 2020, 5:32 PM
Hi Fabricio,

I have found yet another difficult issue in our migration. We have a button in a grid cell, that, when clicked is supposed to show a window with a grid if the server call returns data.

This is the code called when the button is clicked:


var onQAFClicked = function (column, command, record, recordIndex, cellIndex) {
var urlN = "../../api/Sales/getpricelist/" + record.data.uniq_key + "/" + App.ccustno.getValue();
Ext.Ajax.request({
url: urlN,
method: "GET",
success: function (response, opts) {
var res = Ext.JSON.decode(response.responseText);
if (res.data.length > 0) {
debugger;
var qafStore = App.getQAFWindow()
.down("grid")
.getStore();
qafStore.getProxy().url = urlN;
qafStore.load(); //We're getting to this line successfully, with good data
} else {
Ext.Msg.alert("Spotlight", "No QAF Found");
}
}
});
};

This is the declaration of the window:


<ext:Window
runat="server"
IDMode="Ignore"
Title="List of Types"
Collapsible="true"
Maximizable="true"
Width="750"
Height="400"
CloseAction="Destroy"
Layout="Fit"
Plain="true"
BodyPadding="5"
ButtonAlign="Center"
TemplateWidget="true"
TemplateWidgetFnName="getQAFWindow">
<Items>
<ext:GridPanel ID="grdQAF" Header="false" runat="server" Title="QAF">
<Store>
<ext:Store
ID="storeQAF"
runat="server" AutoLoad="false">
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="CustName" Type="String" />
<ext:ModelField Name="Uniq_Key" Type="String" />
<ext:ModelField Name="cCustNo" Type="String" />
<ext:ModelField Name="cPart_No" Type="String" />
<ext:ModelField Name="cRevision" Type="String" />
<ext:ModelField Name="nFUT" Type="Float" />
<ext:ModelField Name="nFromQty" Type="Float" />
<ext:ModelField Name="nICT" Type="Float" />
<ext:ModelField Name="nMatlPrice" Type="Float" />
<ext:ModelField Name="nMech" Type="Float" />
<ext:ModelField Name="nOthers" Type="Float" />
<ext:ModelField Name="nPCB_Assy" Type="Float" />
<ext:ModelField Name="nToQty" Type="Float" />
<ext:ModelField Name="nTotalPrice" Type="Float" />
<ext:ModelField Name="nZMarkup" Type="Float" />
</Fields>
</ext:Model>
</Model>
<Proxy>
<ext:RestProxy Json="true" Url="../../api/Sales/getpricelist/{0}/{1}">
<Reader>
<ext:JsonReader RootProperty="data" TotalProperty="total" />
</Reader>
</ext:RestProxy>
</Proxy>
</ext:Store>
</Store>
<Plugins>
<ext:FilterHeader runat="server" />
</Plugins>
<ColumnModel>
<Columns>
<ext:RowNumbererColumn Width="80px" runat="server" Text="QAF_NO" />
<ext:Column runat="server" Text="FROM" DataIndex="nFromQty" />
<ext:Column runat="server" Text="TO" DataIndex="nToQty" />
<ext:Column runat="server" Text="PCB_ASSEMBLY" DataIndex="nPCB_Assy" />
<ext:Column runat="server" Text="ICT" DataIndex="nICT" />
<ext:Column runat="server" Text="FUT" DataIndex="nFUT" />
<ext:Column runat="server" Text="MECHNICAL" DataIndex="nMech" />
<ext:Column runat="server" Text="OTHERS" DataIndex="nOthers" />
<ext:Column runat="server" Text="MARKUP" DataIndex="nZMarkup" />
<ext:Column runat="server" Text="MATERIAL" DataIndex="nMatlPrice" />
<ext:Column runat="server" Text="TOTAL_PRICE" DataIndex="nTotalPrice" />
</Columns>
</ColumnModel>

<SelectionModel>
<ext:RowSelectionModel Mode="Single" runat="server" />
</SelectionModel>

</ext:GridPanel>
</Items>
</ext:Window>

The window is successfully instantiated, and the code successfully calls the load function on the store, but fails to appear. The code jumps deeply into ext.axd functionality that I cannot follow. The Model in the store did not originally have a member for every value returned from the server call, so I added the missing ones.

Incidentally, the Ext.Msg.alert("Spotlight", "No QAF Found") functionality works fine, the message appears correctly if the server returns no records.

I also tested adding a call to App.getQAFWindow().show(), and the window successfully appears, with the correct columns in the grid, but with no data.

Obviously this was working fine in EXT 2.5.3 or I wouldn't be asking the question here. I can't figure out how to troubleshoot the store's load function. Every call to ext.axd code opens yet another pane in the debugger, which I must wait to fully load before I can tell VS to Pretty Print the file. It seems to be the same file getting called over and over, I can't figure out why it wants to show another copy of the file each time.

As usual, this probably cannot be reproduced in a simple sample, and numerous other places in the application call on a window like this and it works fine.

I also tried removing IDMode="Ignore" and giving the window an explicit ID, but this made no difference.

So, I know you probably can't look at this sample and just "give me a solution," but I'm hoping that you'll be able to help with clues or debugging methods I don't yet know.

Thanks, Bob Graham

fabricio.murta
May 26, 2020, 8:08 PM
Hello Bob!

Sorry you found yet another issue, for the code you show it looks like the project makes extensive use of client-side custom code, that makes things more prone to break.

I mean, the server-side call is made by a "hand-crafted" ajax call and not a direct method/event, so things end up getting out of Ext.NET's control as you may have noticed.

Well, what does not add up in the sample you shown is this couple items:
- the window is not initially hidden by the code you shown; so when is it supposed to be "shown" other than at the very page load?
- there is absolutely no clues on code that call window's .show() method. I believe you should identify this part of the code then analyze why it is not being reached.

Again, you get no javascript client-side error/exception thrown? Are you running in debug mode with scriptMode="debug"
and sourceFormatting="true"?

I'm not sure I can even hope this helps you solve the issue, but piecing together that missing parts will surely help us understand a bit more of the problem to try to help you.

rgraham
May 29, 2020, 11:01 PM
Hi Fabricio,

Finally found the problem. AutoShow on the Window happened by default with EXT 2.5.3 (even though it appeared to default to False in the properties window), but I had to explicitly set AutoShow="True" in EXT V5 to have the child window show.

Such a simple thing!

Bob Graham

fabricio.murta
May 30, 2020, 12:09 AM
Hello Bob!

That is indeed strange; this is a behavior that didn't change from Ext.NET 2 to now. We have to explicitly set a window as hidden for it not to show on page load, as you can see in this example: Window > Basic > Hello World (https://examples5.ext.net/#/Window/Basic/Hello_World/)

In fact, I just tested that example and, if I remove the window's hidden setting, it is shown as I load the sample.

But anyway, glad you could find a solution that worked for you. Sure there must be something overriding that default for you, but guess what matters is that it works now the way you need, right?

rgraham
May 30, 2020, 12:12 AM
Yes, there are many mysteries in a GB++ solution. We are doing this all over fresh soon, the rush in this case is just to stop our users from being forced to use an outdated version of Chrome.