Out Of Memory in store[GridPanel, ComboBox]

  1. #1

    Out Of Memory in store[GridPanel, ComboBox]

    Hi,
    I have many difficulties with store component when i use it with a ComboBox, or GridPanel. When i try to load or reload it, i have continually out of memory exception. I don't know what is wrong in my code. For example, in GridPanel in view, i have this statement for reload a grid when i add a new entities
                   //Grid of sale lines
                            X.GridPanel()
                                .Title("Command lines state")
                                .Disabled(true)
                                .MarginSpec("0 0 0 10")
                                .ID("CommandLinesGrid")
                                .Flex(1)
                                .MarginSpec("0 0 0 0")
                                .Frame(true)
                                .Collapsible(true)
                                .Store(
                                    X.Store()
                                        //.RemotePaging(true)
                                        .AutoLoad(false)
                                        .ID("CustomerOderLinesProperties")
                                        .Proxy(
                                           X.AjaxProxy()
                                            .Url(Url.Action("CustomerOderLines","Command"))
                                            .ActionMethods(ac => ac.Read = HttpMethod.POST)
                                            .Reader(X.JsonReader().RootProperty("data"))
                                        )
                                        .Model(
                                            X.Model()
                                                .Fields(
                                                    new ModelField() { Name = "CustomerOrderLineID", Type = ModelFieldType.Int },
                                                    //new ModelField() { Name = "Product", Type = ModelFieldType.Object },
                                                    new ModelField() { Name = "LineOrderPartialPrice", Type = ModelFieldType.Int },
                                                    new ModelField() { Name = "LineOrderUnitPrice", Type = ModelFieldType.Int },
                                                    new ModelField() { Name = "LineOrderQuantity", Type = ModelFieldType.Int },
                                                    new ModelField() { Name = "ProductLabel", Type = ModelFieldType.String  },/*
                                                    new ModelField() { Name = "PersonSurname", Convert = { Fn = "preparePersonSurname" } },*/
                                                    new ModelField() { Name = "LineOrderSellingPrice", Type = ModelFieldType.Int }
                                                )
                                        )
                                )
                                .ColumnModel(
                                    X.Column()
                                            .Text("Identifiant")
                                            .DataIndex("CustomerOrderLineID")
                                            .Flex(1)
                                            ,
                                    X.Column()
                                        .Text("Product label")
                                        .DataIndex("ProductLabel")
                                        .Flex(1),
                                    X.Column()
                                        .Text("Selling price")
                                        .DataIndex("LineOrderSellingPrice")
                                        .Flex(1)
                                        ,
                                    X.Column()
                                        .Text("Quantity")
                                        .DataIndex("LineOrderQuantity")
                                        .Flex(1),
                                    X.Column()
                                        .Text("Partial price")
                                        .DataIndex("LineOrderPartialPrice")
                                        .Flex(1),
                                    X.ImageCommandColumn()
                                                .Width(30)
                                                .Hidden(LoadAction.Utilisateur(MenuAction.DELETE, profile))
                                                .Commands(
                                                    X.ImageCommand()
                                                        .CommandName("Delete")
                                                        .IconCls("icon-broom")
                                                        .ToolTip(tt =>
                                                            {
                                                                tt.Text = "Do you want to delete it?";
                                                                tt.Title = "Delete";
                                                            }
                                                            )
                                                )
                                                .DirectEvents(de =>
                                                {
                                                    de.Command.Action = "RemoveCustomerOrderLine";
                                                    de.Command.Confirmation.ConfirmRequest = true;
                                                    de.Command.Confirmation.Message = Resources.ConfirmDeleteMessage;
                                                    de.Command.Confirmation.Title = Resources.ConfirmDeleteTitle;
                                                    de.Command.ExtraParams.Add(new Parameter("ID", "record.data.CustomerOrderLineID", ParameterMode.Raw));
                                                    de.Command.EventMask.ShowMask = true;
                                                    de.Command.EventMask.Msg = Resources.EventMaskMsg;
                                                }),
                                    X.ImageCommandColumn()
                                            .Width(30)
                                            .Hidden(LoadAction.Utilisateur(MenuAction.UPDATE, profile))
                                            .Commands(
                                            X.ImageCommand()
                                                    .CommandName("Edit")
                                                    .IconCls("icon-edit")
                                                    .ToolTip(tt => tt.Text = "Update ?")
                                            )
    
                                            .DirectEvents(de =>
                                            {
                                                de.Command.Action = "InitializeFields";
                                                de.Command.ExtraParams.Add(new Parameter("ID", "record.data.CustomerOrderLineID", ParameterMode.Raw));
                                                de.Command.EventMask.ShowMask = true;
                                                de.Command.EventMask.Msg = Resources.EventMaskUpdate;
                                            })
                                    )
                                    .BottomBar(
                                            X.PagingToolbar()
                                    )
                            //End Grid of sale lines
    In CommandController, i have this StoreResult that return a list of commad lines for example that has previously add in session
            //Return command lines of current command
            [HttpPost]
            public StoreResult CustomerOderLines()
            {
                List<CustomerOrderLine> customerOrderLine = (List<CustomerOrderLine>)Session["customerOrderLines"];
                return this.Store(customerOrderLine);
            }
    and, when i add a new command line, i call this method of same controller
            //This method add a CustomerOrderLine in the current Customer's Order
            [HttpPost]
            public ActionResult AddCustomerOrderLine(CustomerOrderLine customerOderLine)
            {
                List<CustomerOrderLine> customerOrderLines = (List<CustomerOrderLine>)Session["customerOrderLines"];
                if (customerOrderLines != null && customerOrderLines.Count > 0)
                {
                    CustomerOrderLine customerOrderLineExist = customerOrderLines.FirstOrDefault(s => s.ProductID == customerOderLine.ProductID);
                    if (customerOrderLineExist == null)
                    {
                        CustomerOrderLine newArticle = new CustomerOrderLine()
                        {
                            CustomerOrderLineID = 1 + customerOrderLines.LastOrDefault().CustomerOrderLineID,
                            LineOrderUnitPrice = customerOderLine.LineOrderSellingPrice,
                            LineOrderQuantity = customerOderLine.LineOrderQuantity,
                            LineOrderSellingPrice = customerOderLine.LineOrderSellingPrice,
                            ProductID = customerOderLine.ProductID,
                            Product = _productRepository.Find(customerOderLine.ProductID),
                            LocalizationID = customerOderLine.LocalizationID,
                            LineOrderPartialPrice = customerOderLine.LineOrderQuantity * customerOderLine.LineOrderSellingPrice
                        };
                        customerOrderLines.Add(newArticle);
                    }
                    else
                    {
                        customerOrderLineExist.LineOrderQuantity += customerOderLine.LineOrderQuantity;
                        customerOrderLineExist.LineOrderSellingPrice += customerOderLine.LineOrderSellingPrice;
                        customerOrderLineExist.LineOrderSellingPrice = customerOrderLineExist.LineOrderQuantity * customerOderLine.LineOrderSellingPrice;
    
                    }
    
                }
                else
                {
                    customerOrderLines = new List<CustomerOrderLine>();
                    CustomerOrderLine newArticle = new CustomerOrderLine()
                    {
                        CustomerOrderLineID = 1,
                        LineOrderUnitPrice = customerOderLine.LineOrderSellingPrice,
                        LineOrderQuantity = customerOderLine.LineOrderQuantity,
                        LineOrderSellingPrice = customerOderLine.LineOrderSellingPrice,
                        ProductID = customerOderLine.ProductID,
                        Product = _productRepository.Find(customerOderLine.ProductID), 
                        LocalizationID = customerOderLine.LocalizationID,
                        LineOrderPartialPrice = customerOderLine.LineOrderQuantity * customerOderLine.LineOrderSellingPrice
                    };
                    customerOrderLines.Add(newArticle);
                }
                Session["customerOrderLines"] = customerOrderLines;
                this.GetCmp<GridPanel>("CommandLinesGrid").Disabled = false;
                this.GetCmp<Store>("CustomerOderLinesProperties").Reload();
                this.GetCmp<FormPanel>("FormAddCustomerOrderLine").Reset();            
                this.GetCmp<TextField>("TotalPrice").Hidden = false;
                this.GetCmp<TextField>("GridState").Value = 1;
                this.GetCmp<TextField>("TotalPrice").Value = customerOrderLines.Select(s => s.LineOrderPartialPrice).Sum();
                return this.Direct();
            }
    Occasionally, it add one command line and when i try to add another, i have this exception or empty error windows. Thank you in advance.
    Last edited by kdms; Jul 01, 2015 at 5:41 PM.
  2. #2
    Hi @kdms,

    Difficult to say what might be wrong. I could investigate it in greater details if you are able to provide a simplified and runnable test case to reproduce the problem on my side.

Similar Threads

  1. [CLOSED] IE8 Memory leaking
    By jcarlos in forum 2.x Legacy Premium Help
    Replies: 11
    Last Post: Oct 10, 2014, 10:24 AM
  2. [1.5]Big bug for ext memory leak!
    By tms2003@126.com in forum 1.x Help
    Replies: 1
    Last Post: Dec 11, 2012, 9:24 AM
  3. [CLOSED] [1.2] Memory
    By Timothy in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 15, 2012, 6:31 PM
  4. Out of memory
    By theblackcat_2902 in forum 1.x Help
    Replies: 1
    Last Post: May 08, 2011, 1:09 AM
  5. Memory Leak in I.E.
    By crazypsdev in forum 1.x Help
    Replies: 6
    Last Post: Nov 09, 2009, 9:55 AM

Tags for this Thread

Posting Permissions