MenuSelected event gets called twice in 5.1

Page 2 of 2 FirstFirst 12
  1. #11
    Glad to see we may be making progress. I'll try to answer the topics, following the logic of the last post.

    Quote Originally Posted by rgraham
    The grid we are using has the infinite scrolling feature being used, it is only in this scenario that we have seen issues with the filter header not showing.
    We would be quite willing to address this issue if you opened a dedicated thread for it. I see old reports of the issue but it hardly looks like the same, and they come from before Ext.NET 2.5.0, so it really does not look like the exact same issue. May be worth some investigation.

    Quote Originally Posted by rgraham
    Yes, [the method is not being called twice,] I wonder if our code is not causing the duplicate load, but rather something internal to the ExtJS code. The question is how do we cause it to perhaps skip the first load pending the final Reconfigure?
    ~

    Step thru the returned javascript code and note the moments where the component shows being loaded twice. The commented code for stop layout and then resume layouts seems like might have been a workaround back in 2.x to prevent layout updates until the reconfigure was triggered -- maybe you can delay the resume layouts bit to happen after the reconfigure (probable) defer()'ed load happens.

    You may experiment with just keeping the X.Js.Call("Ext.suspendLayouts"); in the direct method, and then manually calling the counterpart (resumeLayouts) in developer tools, and check if this results in only one "flash" of the screen. It may be "flashing" when (a) it gets its store wiped to comport the new layout and (b) when the new layout is input and it loads its data. It is not necessarily "dual-loading" (although you might be seeing something that ensures you it is double-loading, of course).

    If this delayed call of Ext.resumeLayouts() seems fruitful, you may want to consider converting the DirectMethod into a DirectEvent, and having Before= and After= handlers commanding the layout freeze and resume; optionally applying a mask on the screen during the server side call, should it take long enough to look "strange" to the interface.

    Quote Originally Posted by rgraham
    Yes, I knew about the ScriptMode="debug" option but the SourceFormatting="true" option helped to accelerate seeing the code "pretty" formatted.
    The SourceFormatting setting could work better with a proper JS beautifier, which was not available or mature when the feature was developed; but the way it is is really better than nothing. You can improve it even further if you use that little lower-left corner button that reads { } in Google's Chrome developer tools to properly indent any code in source tab.

    Quote Originally Posted by rgraham
    Is there an example of this on the EXT site? It might be easiest to cancel the line that originally loads the data the first time, though I would need to locate the exact line first.
    The whole extnet/extnet-all-debug-js embedded resource (extnet-all-debug.js) is made of overrides for the extjs/ext-all-debug-js one. Here's how you would override the grid panel's reconfigure() client-side method.

    I could copy the whole code (it's pretty long) so, for brevity, I'll show another usage: calling its overridden method.

    Ext.defined('thread62850', {
        override: 'Ext.grid.Panel',
        reconfigure: function(store, columns, allowUnbind, applyState) {
            var me = this;
    
            Ext.toast("Before I run original reconfigure.");
            me.callParent(arguments);
            Ext.toast("After I run original reconfigure.");
        }
    });
    As you may have figured, if you don't want the original code to run, and change something inside it, instead of the callParent(), just paste its code and change what is needed. In case the code you pasted had a callParent() (and you don't want the parent to be called, but the "parent's parent", there's the callSuper() to call its superclass (parent class). You probably won't need to worry with this for now, but it is good to know.

    Quote Originally Posted by rgraham
    NEW THOUGHT: Is there any way for you to pinpoint the particular line that fills the grid once the data comes back from the server?
    Not for me, from here. I don't see how I could pinpoint the code line that fills the grid as there may be so many different ways for that to trigger. But if I had a runnable test case here, what I would do would be, step thru the returned code from the direct method. If adding a breakpoint is not feasible (as new code comes from the server every request), you could add a callback and break in it, or just add a raw debugger; call from the direct method (X.AddScript("debugger;"); in code behind should do) and let it stop there; then step thru.

    Quote Originally Posted by rgraham
    I have mostly been using the Sources tab in Developer Tools but perhaps I need to be looking more closely at the Network tab or the Console
    Yes, you've been missing the direct method result all the time by ignoring the network tab. Experiment with loading the page (lots of output), clear output right before you do whatever it takes for the direct method to be run. You'll see a non-parsed JSON or Javascript return as the response body; in this scope you can't step thru the code as it is but text that will be eval'd (or expanded) by Ext.NET's ajax handlers.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  2. #12
    Fabricio, are you able to put together a simple example combining InfiniteScroll and FilterHeader with server side data loading?

    I'm trying to right now, but I'm having a hard time with wiring up the filter behavior. This is likely because I'm still pretty new at EXT :-)

    I have no idea how to wire up a back-end to the filter behavior code.

    When I put a script in the page that includes "Ext.define.xxx" I get an error that Ext is undefined. In the markup the <%@ Register Assembly="Ext.Net" Na... header at the top of the page works fine, but where do you tell it about the JavaScript files?

    I haven't built any EXT apps from the start, I inherited all of this already LARGE and in use for several years, so I don't know the basic steps of creating an EXT app.

    All very frustrating.
    Last edited by rgraham; Mar 03, 2020 at 10:31 PM.
  3. #13
    ...and,

    The most puzzling part is that the same code works fine loading the grid the first time.

    I think I've mentioned this before, but, on subsequent loads we get a lot of lines saying:
    [W] Ext.grid.header.Container attempted to reuse an existing id: buy_qty
    Attaching a screen grab of some of the detail.

    As these seem to be warnings, I'm not thinking that they are the problem, but who knows?


    Click image for larger version. 

Name:	Error when reload.jpg 
Views:	70 
Size:	59.3 KB 
ID:	25312
  4. #14
    Hello again, @rgraham!

    Quote Originally Posted by rgraham
    Fabricio, are you able to put together a simple example combining InfiniteScroll and FilterHeader with server side data loading?
    It'd be best to be discussed in a separate forum thread.

    Quote Originally Posted by rgraham
    When I put a script in the page that includes "Ext.define.xxx" I get an error that Ext is undefined. In the markup the <%@ Register Assembly="Ext.Net" Na... header at the top of the page works fine, but where do you tell it about the JavaScript files?
    We could cover this topic in a new thread if you still have issues, this is turning into a lot of issues-in-one, don't you agree? Basically, Ext.<whatever> code should only happen after Ext.NET's injected JavaScript code. If you're getting that Ext is undefined most likely means you didn't add a <ext:ResourceManager runat=server /> line to your page.

    You should consider cloning a local copy of the Ext.NET Examples Explorer repository and building it. It is open for everyone and all examples therein are based on "from-scratch" simple scenarios.

    Quote Originally Posted by rgraham
    I haven't built any EXT apps from the start, I inherited all of this already LARGE and in use for several years, so I don't know the basic steps of creating an EXT app.
    When I myself started to work with Ext.NET I created myself a blank project with Ext.NET where I experimented with things. To this day, I still use the multi-project solution (with the various Ext.NET versions as separate projects) to run test cases provided here.

    The advice I can give here then is, you should try some simpler scenarios before you can understand the big picture. I still believe you should consider investing time trying to simplify what you got there. You will get a better grasp of what's involved, and if you don't figure out the issue by yourself, you'll have a sample simple enough to share here and get a definitive answer for it.

    Quote Originally Posted by rgraham
    I think I've mentioned this before, but, on subsequent loads we get a lot of lines saying:
    This has already been commented in post #9, wherein I deal with post #7, I can't think anything else to add to this matter.

    I hope the answers above are acceptable.
    Fabrício Murta
    Developer & Support Expert
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 0
    Last Post: Apr 12, 2017, 11:49 AM
  2. Codebehind event called from Task
    By aluna in forum 1.x Help
    Replies: 1
    Last Post: May 12, 2016, 6:34 PM
  3. Replies: 3
    Last Post: Sep 26, 2014, 7:32 PM
  4. Replies: 2
    Last Post: Aug 30, 2012, 9:37 PM
  5. JavaScript has been called twice
    By harshad.jadhav in forum 1.x Help
    Replies: 3
    Last Post: Apr 21, 2010, 11:36 AM

Posting Permissions