[CLOSED] Generate Parameters of loader dynamically

  1. #1

    [CLOSED] Generate Parameters of loader dynamically

    I have a container which loads a partial view.
    I need to add parameters to it loader dynamically based on the filters seleceted and load the view based on those parameters.
    Following is the code:

    @(Html.X().Container()
                .ID("ViewContainer2")
                .Width(900)
                .Hidden(true)
                .Loader(Html.X().ComponentLoader()
                        .Url(Url.Action("LoadSnapShotPartialView"))
                        .Mode(LoadMode.Script)
                        .Params(new { containerId = "ViewContainer2" })                   
            )
         )
    In my script i am doing:

     var snapShotContainer = Ext.getCmp('ViewContainer2');//.show();
                snapShotContainer.loader.paramsFn = getParamForSnapshot();
                snapShotContainer.show();
    
     var getParamForSnapshot = function ()
        {
            var a = { x: "s" };
            return a;
    
        }
    But its not working. What i am doing wrong?
    Last edited by Daniil; Aug 06, 2013 at 8:23 AM. Reason: [CLOSED]
  2. #2
    Hi @PriceRightHTML5team,

    You should see a JavaScript error like: TypeError: this.paramsFn.call is not a function

    You should replace
    snapShotContainer.loader.paramsFn = getParamForSnapshot();
    with
    snapShotContainer.loader.paramsFn = getParamForSnapshot;
  3. #3
    Thanks Daniil thats working.

    But how do i load the container dynamically.Initially its hidden and when i click submit it loads up for the first time.
    Next time when i change the filter parameters and click submit it doesn't load with the updated parameters.

    Here's what my code looks like:

    var btnSubmit_Click = function () {
            debugger;
            var items = App.CmbTimeBasis.getValue();
         
            if (items == "1") {
                var snapShotContainer = Ext.getCmp('ViewContainer2');
                snapShotContainer.loader.paramsFn = getParamForSnapshot;
                if (snapShotContainer.hidden) {
                    snapShotContainer.show();
                }
                else {
                    snapShotContainer.hide();
                    snapShotContainer.show();
    
                }
            }
        }
  4. #4
    I think you should call the reload method.
    snapShotContainer.reload();
    Or configure a Loader with:
    <Loader TriggerEvent="show" ReloadOnEvent="true" />

Similar Threads

  1. Replies: 9
    Last Post: Sep 16, 2013, 3:19 PM
  2. Replies: 5
    Last Post: Jun 12, 2013, 2:49 AM
  3. MVC Razor Dynamically generate view
    By Ishrath in forum 2.x Help
    Replies: 0
    Last Post: Oct 11, 2012, 3:54 AM
  4. MVC Razor - Generate menu item dynamically
    By Ishrath in forum 2.x Help
    Replies: 0
    Last Post: Sep 27, 2012, 1:51 AM
  5. [CLOSED] generate dynamically LayoutConfig to a Panel
    By rnfigueira in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 26, 2011, 4:14 PM

Tags for this Thread

Posting Permissions