[CLOSED] Suddenly Dynamic ComboBox Component stopped working after 3 months of smooth work!!!!

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Suddenly Dynamic ComboBox Component stopped working after 3 months of smooth work!!!!

    hi,

    1. i didn't change anything in Ext.net at all.
    2. i didn't touch the code of the dynamic control at all.
    3.the dynamic combobox already posted in this link:
    http://forums.ext.net/showthread.php...ng-directEvent

    4. the dynamic combobox rendred using

    control.Render(this.pnlParameters, Extention.RenderMode.AddTo);
    5. As I said the control was working fine for the last 3 months and then suddenly stopped working!!!!
    6. after looking to the response of the event calling the render above, it shows that the combobox is of mode=local even if i set it to remote its still doing it local!!!!
    new Ext.form.ComboBox({id:"clientInvoiceId",xtype:"combo",anchor:"95%",fieldLabel:"Client Invoice No",allowBlank:false,blankText:"Client Invoice No is required",displayField:"clientInvoiceNo",hiddenName:"clientInvoiceId_Value",loadingText:"refreshing ...",mode:"local",pageSize:50,queryDelay:10,triggerAction:"all",valueField:"clientInvoiceId",
    
    store:this.clientInvoiceId_stoId=
    new Ext.net.Store({proxyId:"clientInvoiceId_stoId",
    proxy:new Ext.data.HttpProxy({method:"POST",url:"Services/GenericService.asmx/LoadInvoiceData",json:true}),
    reader:new Ext.data.JsonReader({fields:[{name:"clientInvoiceId"},{name:"clientInvoiceNo"}],root:"d.Data",totalProperty:"d.TotalRecords"}),directEventConfig:{},beforeLoadParams:function(store,options){if (!options.params){options.params = {};};
    so i think the problem occurs because of mode=local because the control rendered fine but the store data not populated and event no request send to the web-service to fetch data and no bug shown in firebug!!!

    please help..I'm going crazy!

    bye,
    Last edited by Daniil; May 02, 2011 at 10:39 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Are you experiencing the issue after update from SVN?
  3. #3
    no, i said i didn't update since 3 months as things was working fine for me. i know that update might fix the problem but i need to understand why this happened without updating!! otherwise I will have doubts in the technology i'm using.
  4. #4
    Hi,

    I cannot reproduce the problem,
    Here is my test case
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Ext.Net Example</title>
        
        <script runat="server">
            protected void RenderClick(object sender, DirectEventArgs e)
            {
                var ddl = new ComboBox();
                ddl.LoadingText = "refreshing ...";
    
                ddl.DisplayField = "bookingOrderNo";
                ddl.ValueField = "bookingOrderId";
    
                var x = new Store();
                x.ID = "strDyn";
                x.AutoLoad = false;
                HttpProxy storeProxy = new HttpProxy();
                storeProxy.Json = true;
                storeProxy.Method = HttpMethod.POST;
                ddl.PageSize = 0;
                x.BaseParams.Add(new Ext.Net.Parameter("dbTableName", "Orders", ParameterMode.Value));
                x.BaseParams.Add(new Ext.Net.Parameter("valueField", "OrderId", ParameterMode.Value));
                x.BaseParams.Add(new Ext.Net.Parameter("displayField", "OrderNo", ParameterMode.Value));
                storeProxy.Url = "Service.asmx/LoadData";
                x.Proxy.Add(storeProxy);
                JsonReader reader = new JsonReader();
                reader.Root = "d";
                reader.Fields.Add(ddl.ValueField);
                reader.Fields.Add(ddl.DisplayField);
                x.Reader.Add(reader);
                ddl.Store.Add(x);
    
                ddl.Render("Panel1", RenderMode.AddTo);
            }
        </script>
    </head>
    <body style="padding: 20px;">
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        
        <ext:Panel ID="Panel1" runat="server" Title="Panel" Width="300" Height="300" Layout="FormLayout">    
        </ext:Panel>
        
        <ext:Button runat="server" Text="Render combo">
            <DirectEvents>
                <Click OnEvent="RenderClick" />
            </DirectEvents>
        </ext:Button>
        </form>
    </body>
    </html>
    Please post DirectEvent handler code and full text of response
  5. #5
    the dynamic combo is part of sub-classed formpanel which work as reports center control: so upon report selected the dynamic combo rendered [the combo is used in case the report got parameters, like report of invoice type it need parameter which is invoice no]

    so in formPanel here is the main parts/events related to the dynamic problem, although this should not be the problem since this code was already working fine!!! but as you request my friend here we go:

    using Extention = Ext.Net;
    public class ReportSelector : Extention.FormPanel//UserControl
        {
            #region Private Members
            private readonly Extention.Button btnShowReport = new Extention.Button();
            private readonly Extention.Button btnSendReport = new Extention.Button();
            private readonly Extention.ComboBox ddlReportsList = new Extention.ComboBox();
            private Extention.Panel pnlParameters = new Extention.Panel();
            private StateManagedCollection<ReportInfo> reports;/*not related stuff to the problem*/
            private StateManagedCollection<ReportParameter> paramters;
            #endregion
    protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
                InitControls();
                CreateReportsList();
                this.Items.Add(ddlReportsList);
                this.Items.Add(pnlParameters);/*this the panel that dynamic combo renders inside*/
            }
    
            /// <summary>
            /// Load control, second step in object life cycle
            /// </summary>
            /// <param name="e">Load event args</param>
            protected override void OnLoad(EventArgs e)
            {
                base.OnLoad(e);
                this.pnlParameters.RemoveAll();
                CreateReportParameters(); /*this the parent method that create the combo*/
                CreateReportSortList();
            }
    
    private void CreateReportParameters()
            {
                var report = this.Reports.FirstOrDefault(x => x.ReportTitle == ddlReportsList.SelectedItem.Text);
                if (report != null)
                {
                    if (report.Parameters.Count > 0)
                    {
                        var c = new Extention.Label();
                        c.ID = "lblTitle";
                        c.FieldLabel = "Report Parameters";
                        c.LabelSeparator = "";
                        c.LabelStyle = "color:green;font-weight:bold;";
                        c.Render(this.pnlParameters, Extention.RenderMode.AddTo);
                    }
                    foreach (ReportParameter param in report.Parameters)
                    {
                        CreateParamter(param); /*this the method that create the combo*/
                    }
                }
            }
    private void CreateParamter(ReportParameter param)
            {/*this method include too much code not related to the bug!!! so i removed it*/
    Extention.ComboBox ddl = new Extention.ComboBox();
                        
                        ddl.LoadingText = "refreshing ...";
    
                        ddl.DisplayField = ((DropDownListParameter)param).DisplayField;
                        ddl.ValueField = ((DropDownListParameter)param).ValueField;
    
                        var x = new Extention.Store();
                        x.ID = String.Format("{0}_stoId", param.Name);
                        x.AutoLoad = false;
                        Extention.HttpProxy storeProxy = new Extention.HttpProxy();
                        storeProxy.Json = true;
                        storeProxy.Method = Extention.HttpMethod.POST;
                        ddl.PageSize = 50;
                        x.AutoLoadParams.Add(new Ext.Net.Parameter("start", "0", Extention.ParameterMode.Raw));
                        x.AutoLoadParams.Add(new Ext.Net.Parameter("limit", ddl.PageSize.ToString(), Extention.ParameterMode.Raw));
                        x.BaseParams.Add(new Ext.Net.Parameter("dbTableName", ((DropDownListParameter)param).DBTableName, Extention.ParameterMode.Value));
                        x.BaseParams.Add(new Ext.Net.Parameter("valueField", ((DropDownListParameter)param).ValueField, Extention.ParameterMode.Value));
                        x.BaseParams.Add(new Ext.Net.Parameter("displayField", ((DropDownListParameter)param).DisplayField, Extention.ParameterMode.Value));
                        x.BaseParams.Add(new Ext.Net.Parameter("additionalColumns", "", Extention.ParameterMode.Value));
                        x.BaseParams.Add(new Ext.Net.Parameter("pageSize", ddl.PageSize.ToString(), Extention.ParameterMode.Value));
                        storeProxy.Url = "Services/GenericService.asmx/LoadData";
                        x.Proxy.Add(storeProxy);
                        Extention.JsonReader reader = new Extention.JsonReader();
                        reader.Root = "d.Data";
                        reader.TotalProperty = "d.TotalRecords";
                        reader.Fields.Add(ddl.ValueField);
                        reader.Fields.Add(ddl.DisplayField);
                        x.Reader.Add(reader);
                        ddl.Store.Add(x);
                        ddl.AnchorHorizontal = "95%";
                        ddl.ID= param.Name;
                        AddParameter(param.Label, ddl, true);/*this will render the combo*/
    }
    private void AddParameter(string title, Extention.Component control, bool isRequired)
            {
                control.FieldLabel = title;
                if (isRequired)
                {
                    ((Extention.TextFieldBase)control).AllowBlank = false;
                    ((Extention.TextFieldBase)control).BlankText = String.Format("{0} is required", title);
                }
                //this.Items.Add(control);
                control.Render(this.pnlParameters, Extention.RenderMode.AddTo);
                this.pnlParameters.Items.Add(control);
            }
  6. #6
    also this is the response upon report selected:

    "Ext.net.ResourceMgr.load([{url:"/WebClouders.Media.UserServices/extnet/extnet-data-js/ext.axd?v=24608"}], function(){pnlReportSelection.setTitle("Select Report");pnlReportSelection.frame=true;pnlReportSelection.padding=5;pnlReportSelection.setWidth(300);pnlReportParameters.removeAll();Ext.net.ResourceMgr.destroyCmp("lblTitle");new Ext.form.Label({id:"lblTitle",xtype:"label",labelSeparator:"",labelStyle:"color:green;font-weight:bold;",fieldLabel:"Report Parameters"});pnlReportParameters.addAndDoLayout(lblTitle);Ext.net.ResourceMgr.destroyCmp("clientInvoiceId");new Ext.form.ComboBox({id:"clientInvoiceId",xtype:"combo",anchor:"95%",fieldLabel:"Client Invoice No",allowBlank:false,blankText:"Client Invoice No is required",displayField:"clientInvoiceNo",hiddenName:"clientInvoiceId_Value",loadingText:"refreshing ...",mode:"local",pageSize:50,queryDelay:10,triggerAction:"all",valueField:"clientInvoiceId",store:this.clientInvoiceId_stoId=new Ext.net.Store({proxyId:"clientInvoiceId_stoId",proxy:new Ext.data.HttpProxy({method:"POST",url:"Services/GenericService.asmx/LoadData",json:true}),reader:new Ext.data.JsonReader({fields:[{name:"clientInvoiceId"},{name:"clientInvoiceNo"}],root:"d.Data",totalProperty:"d.TotalRecords"}),directEventConfig:{},beforeLoadParams:function(store,options){if (!options.params){options.params = {};};Ext.apply(options.params,{"dbTableName":"ClientInvoices","valueField":"clientInvoiceId","displayField":"clientInvoiceNo","additionalColumns":"","pageSize":"50"});Ext.applyIf(options.params,{});}}),submitValue:true});pnlReportParameters.addAndDoLayout(clientInvoiceId);});"
  7. #7
    Hi,

    1. Unfortunately, you did not show how do you use that control (FormPanel). I need test sample which can be run localy
    2. Your code is a little bit strange for me. Why do use 'this.pnlParameters.RemoveAll();' on the OnLoad method? It generates scripts for removing all items in that controls and script will be generated on each request where that control is presented.
    Why do you render combos on each request (in the OnLoad method)?

    Your code did not answer why you have mode:local because local mode is used if no store only

    So, please create test sample which we can run localy
  8. #8
    Quote Originally Posted by Vladimir View Post
    Hi,

    1. Unfortunately, you did not show how do you use that control (FormPanel). I need test sample which can be run localy
    2. Your code is a little bit strange for me. Why do use 'this.pnlParameters.RemoveAll();' on the OnLoad method? It generates scripts for removing all items in that controls and script will be generated on each request where that control is presented.
    Why do you render combos on each request (in the OnLoad method)?

    Your code did not answer why you have mode:local because local mode is used if no store only

    So, please create test sample which we can run localy
    1. that's very hard because report-center [which the formPanel part of it] constructed of 10 server side classes and linked to telerik reports which i can't pass it.
    2. 'this.pnlParameters.RemoveAll();' used because not all reports got same parameters or any parameters at all!, i know its not good way but it was working for this release at least!

    3. can you provide sample/method on how to generate dynamic combos for report parameters upon report selection without removing the previously loaded ones!

    I'll try to create the formPanel control with just 2 combos 'report selector' and 'report params'. although you should be able to do from the already provided code, but i consider you don't have time for that!

    thanks,
  9. #9
    Hi,

    1. that's very hard because report-center [which the formPanel part of it] constructed of 10 server side classes and linked to telerik reports which i can't pass it.
    Don't you able to reproduce the issue in the simple page with that control (removing unnesessary code from that control)?

    3. can you provide sample/method on how to generate dynamic combos for report parameters upon report selection without removing the previously loaded ones!
    Yes, if you need to rerender combos then previously created must be removed. Just your FormPanel is strange. For example, if you place that control to markup then your combos will be rerenderd for each request (even if the request was initiated by other controls). Also you use dynamic rendering for initial page load (if no ajax request). It is wrong design. I suggest to move dynamic rendering from OnLoad and call Render for combos only when it is required. In any way, i don't know your scenarion therefore i cannot give detailed recommendations

    I'll try to create the formPanel control with just 2 combos 'report selector' and 'report params'. although you should be able to do from the already provided code, but i consider you don't have time for that!
    Just i don't know how do you use that control. I posted the example for create dynamic combo (creating the combo is similar as in your combo) and the issue is not reproducible
  10. #10
    check the attached code... just change namespaces if needed, i just want the second combo render with mode=remote, i mean the webservice will crash since i din't post that code of the webservice, but i consider the problem solved when the combo try to load the store.


    TestCode.zip
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Item disable style stopped working
    By supera in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jan 24, 2012, 6:51 AM
  2. Replies: 12
    Last Post: Jul 25, 2011, 2:25 PM
  3. Ext.Net.ResourceBuilder stopped working
    By purvi in forum 1.x Help
    Replies: 0
    Last Post: Sep 22, 2010, 9:52 PM
  4. [CLOSED] VBoxlayout Stopped Working after SVN update
    By SymSure in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Mar 23, 2010, 3:17 PM
  5. EventMasks stopped working
    By EzaBlade in forum 1.x Help
    Replies: 5
    Last Post: Mar 24, 2009, 6:21 PM

Tags for this Thread

Posting Permissions