[CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Dear Team,

    Reference topic : http://forums.ext.net/showthread.php...8107-16-1.aspx

    We got the latest version from SVN (Build 0.8.2) for topic mentioned above. We tested the testing site and as well as we implemented in our application also. It is working fine.

    But we are encountering some other problems, which were previously worked fine with 0.8.1.

    1) We have placed a combo box editor in a Grid panel and updating the status from the combo box.
    We have status column in Employee Object and a status descriptive column "Description".
    While changing the status from combo box editor, it is not showing the relevant text (Description) in the grid panel.

    The same code worked fine with 0.8.1. i.e. After edit event handler changed both StatusId and Description in the store of the grid panel and got the correct values.

    Not it is not working as expected in 0.8.2. (after updating recently).

    But we did workaround "Commented line After edit" event handler.

    Is that approach is correct?

    2) This a general problem we are facing even from 0.8.1 also. When we are using a store and combo box combination in grid panel editor, it is always showing "ucUserControl_stStatus" is not found message while binding.

    See respective lines are commented in the attached source code.

    Please advice us in these two scenarios.

    Controls to test.
    Page : Default.aspx
    Usercontrol : EmployeeListWithGridPanel.ascx

    Please note that we are sending the test solution to support email.

    Regards,
    Gopal.


  2. #2

    RE: [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Hi,

    First issue,
    You can use the following AfterEdit handler
    <AfterEdit Handler="if (e.field == 'Description') { e.record.set('Status', #{cmbStatus}.value); e.record.set('Description', #{cmbStatus}.getText());  } " />

    But it is better to use approach from the following example
    https://examples1.ext.net/#/GridPane...Field_Mapping/


    Second issue, it is already fixed in the 1.0 version. Investigating workaround for 0.8.2...
  3. #3

    RE: [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Hi,

    Please update from SVN, rebuild and retest the second issue
  4. #4

    RE: [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Hi,

    I updated from the SVN. But no luck with

    Second issue - "This a general problem we are facing even from 0.8.1 also. When we are
    using a store and combo box combination in grid panel editor, it is
    always showing "ucUserControl_stStatus" is not found message while
    binding."

    Regards,
    Gopal.
  5. #5

    RE: [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Hi,

    Sorry, just my test case didn't reproduce your case 100%
    Can you update from SVN and retest again? I am sure that now your sample should works fine
  6. #6

    RE: [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Hi,

    Still it is not working in my test solution.

    I even tried by removing asp update panel wrapped around this user control.

    Regards,
    Gopal
  7. #7

    RE: [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Hi,

    I tested with your test sample and it works fine. Please ensure that your application doesn't use cached assemblies
    May be you send your test project again (with new assemblies)
  8. #8

    RE: [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Hi Vladimir,

    I am sending the test sample again to your mail. Please test and let us know where we are going wrong.

    Page : Default.aspx
    User Control : EmployeeListWithGridPanel.ascx

    Regards,
    Gopal.
  9. #9

    RE: [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Hi,

    Your attachment contains old assembly (Date modified 26.02.2010 14:21)
    I added the fix yesterday therefore that assembly cannot contain the fix
    Please ensure that you use the latest code from SVN (0.8.2) and rebuild assemblies
  10. #10

    RE: [CLOSED] Grid Panel - Combo Box Editor showing value instead of text after changing.

    Hi,

    Sorry! I didn't update the assemblies in my Bizbites.Utilities project, so, it overwriteen the new coolite assembilies with old ones.

    Here is my trial. But combo box is getting items (count = 4) but there is no data.
    Store is filled with 4 items without data.

    I could not figure out the problem. :(

    Here is the code.

    UserContro.ascx (content)
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="EmployeeListWithGridPanel.ascx.cs"
        Inherits="BizHR.UI.UserControls.HR.EmployeeList" %>
    <%@ Register Assembly="Bizbites.CustomControls" Namespace="Bizbites.CustomControls"
        TagPrefix="biz" %>
    
    <script language="javascript" type="text/javascript">
        var UpdateStatus = function(event, cmbBox) {
            if (event.field == 'Status') {
                event.record.set('StatusId', cmbBox.value);
                event.record.set('Status', cmbBox.getRawValue());
            }
        }
    
        var StatusRenderer = function(value, st) {
            //debugger;
            //var r = st.getById(value);
            var ind = st.find("StatusLookupId", value);
            var r = st.getAt(ind);
    
            if (Ext.isEmpty(r)) {
                return "";
            }
    
            return r.data.Description;
    
        }
    </script>
    
    <asp:ObjectDataSource ID="odsEmployee" runat="server" SelectMethod="GetAll" TypeName="ControlTest.Employee"
        OnInit="odsEmployee_Init" SortParameterName="orderBy">
        <SelectParameters>
            <asp:Parameter Name="startRowIndex" Type="Int32" />
            <asp:Parameter Name="maximumRows" Type="Int32" />
            <asp:Parameter Name="orderBy" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <ext:Store ID="stStatus" runat="server" OnRefreshData="stStatus_RefreshData">
        <Reader>
            <ext:ArrayReader>
                <Fields>
                    <ext:RecordField Name="StatusLookupId" Type="Auto">
                    </ext:RecordField>
                    <ext:RecordField Name="Description" SortType="AsText" Type="String">
                    </ext:RecordField>
                </Fields>
            </ext:ArrayReader>
        </Reader>
    </ext:Store>
    <ext:Store ID="stEmployees" runat="server" OnRefreshData="stEmployees_RefreshData"
        DataSourceID="odsEmployee">
        <Proxy>
            <ext:DataSourceProxy>
            </ext:DataSourceProxy>
        </Proxy>
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="EmployeeId" Type="Auto">
                    </ext:RecordField>
                    <ext:RecordField Name="FirstName" Type="String">
                    </ext:RecordField>
                    <ext:RecordField Name="MiddleName" Type="String">
                    </ext:RecordField>
                    <ext:RecordField Name="Status" Type="Auto">
                    </ext:RecordField>
                    <ext:RecordField Name="Description" Type="String">
                    </ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <center>
        <table width="100%">
            <tr>
                <td>
                    <ext:Toolbar ID="uctbEmployeeList" runat="server">
                        <Items>
                            <ext:Button ID="btnNewEmployee" runat="server" AutoPostBack="True" &#111;nclick="NewEventHandler"
                                Icon="Add" Text="New Employee" AllowDepress="true" CausesValidation="false">
                            </ext:Button>
                            <ext:ToolbarFill Width="1px" ID="ctl35">
                            </ext:ToolbarFill>
                            <ext:Button ID="btnRefresh" runat="server" AutoPostBack="True" Icon="Reload" Text="Reload List"
                                &#111;nclick="Refresh" CausesValidation="false">
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </td>
            </tr>
            <tr>
                <td>
                    <ext:GridPanel ID="gpEmployees" runat="server" ClicksToEdit="1" StoreID="stEmployees"
                        Height="600">
                        <SelectionModel>
                            <ext:CellSelectionModel ID="csmEmployees" runat="server">
                            </ext:CellSelectionModel>
                        </SelectionModel>
                        <ColumnModel ID="cmEmployees" runat="server">
                            <Columns>
                                <ext:Column DataIndex="FirstName" Header="First Name">
                                </ext:Column>
                                <ext:Column DataIndex="LastName" Header="Last Name">
                                </ext:Column>
                                <ext:Column DataIndex="Status" Header="Status">
                                    <Renderer Handler="return StatusRenderer(value, #{stStatus});" />
                                    <Editor>
                                        <ext:ComboBox ID="cmbStatus" runat="server" ReadOnly="true" DisplayField="Description"
                                            ValueField="StatusLookupId" StoreID="stStatus">
                                        </ext:ComboBox>
                                    </Editor>
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <Listeners>
                            <%--<AfterEdit Handler="if (e.field == 'Description') { e.record.set('Status', #{cmbStatus}.value); e.record.set('Description', #{cmbStatus}.getText());  } " />--%>
                            <%--<AfterEdit Handler="UpdateStatus(e, #{cmbStatus}); " />--%>
                        </Listeners>
                    </ext:GridPanel>
                </td>
            </tr>
        </table>
        <%--        </Body>
        </ext:Panel>
    --%></center>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetAll"
        TypeName="ControlTest.Employee">
        <SelectParameters>
            <asp:Parameter Name="startRowIndex" Type="Int32" />
            <asp:Parameter Name="maximumRows" Type="Int32" />
            <asp:Parameter Name="orderBy" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    UserControl.ascx.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using BizHR.UI;
    using Newtonsoft.Json.Linq;
    using Bizbites.Components.Utilities;
    using Bizbites.Components.Converters;
    using Coolite.Ext.Web;
    using ControlTest;
    
    namespace BizHR.UI.UserControls.HR
    {
        public partial class EmployeeList : System.Web.UI.UserControl
        {
            //Employee _ItemToDelete = new Employee();
            protected void Page_Load(object sender, EventArgs e)
            {
            
                if (!IsPostBack)
                {
                    LoadData(new System.IO.StringWriter());
                }
                BindStatus();
            }
    
            public bool LoadData(System.IO.StringWriter swErrors)
            {
                gpEmployees.DataBind();
                return true;
            }
    
            private void BindStatus()
            {
                stStatus.DataSource = (new StatusLookup()).GetAll();
                stStatus.DataBind();
            }
    
    
            protected void stEmployees_RefreshData(object sender, StoreRefreshDataEventArgs e)
            {
                odsEmployee.SelectParameters["orderBy"].DefaultValue = "EmployeeName";
                stEmployees.DataBind();
            }
    
            protected void stStatus_RefreshData(object sender, StoreRefreshDataEventArgs e)
            {
                BindStatus();
            }
    
            public bool SaveData(System.IO.StringWriter swErrors)
            {
                return true;
            }
    
    
            public bool ValidateData(System.IO.StringWriter swErrors)
            {
                return true;
            }
    
            public bool ManagePermissions(System.IO.StringWriter swErrors)
            {
                return true;
            }
    
            public Guid DataKeyId
            {
                get
                {
                    return Session["EmployeeId"] != null ? (Guid)Session["EmployeeId"] : Guid.Empty;
                }
                set
                {
                    Session["EmployeeId"] = value;
                }
            }
    
            public bool DeleteData(System.IO.StringWriter swErrors)
            {
                //Employee objEmployee = new Employee();
                string strRetValue = string.Empty; // = objEmployee.DeleteEmployeeDetails(_ItemToDelete.EmployeeId, swErrors);
                if (strRetValue != string.Empty)
                {
                    string[] strResult = strRetValue.Split('"');
                    string Message = strResult[5];
    
                    if (Message != string.Empty)
                    {
                        Message = Message.Split('.')[1];
                    }
                    Ext.Notification.Show(new Notification.Config
                    {
                        Title = "Failure!",
                        Icon = Icon.Error,
                        Html = "<div style='color:red'>This Employee Has a Dependecy on " + Message + ". Employee Can not Be Deleted!
    ",
                        AutoHide = false,
                        CloseVisible = true
                    });
                }
                else
                {
                    //if (EmployeeDeleted != null)
                    //{
                    //    EmployeeDeleted(this, _ItemToDelete);
                    //}
                    Ext.Notification.Show(new Notification.Config
                    {
                        Title = "Success!",
                        Icon = Icon.Error,
                        Html = "Employee Deleted Successfully!!!",
                        CloseVisible = true
    
                    });
                }
    
                return true;
            }
    
            protected void odsEmployee_Init(object sender, EventArgs e)
            {
                odsEmployee.SelectParameters["orderBy"].DefaultValue = "EmployeeName";
                //odsEmployee.SelectParameters["companyId"].DefaultValue = "332A14EF-54C0-4B5F-A22D-BB25AD9725A7";
                //odsEmployee.SelectParameters["employeeId"].DefaultValue = Guid.Empty.ToString();
            }
    
    
            protected void gvEmployee_RowCommand(object sender, GridViewCommandEventArgs e)
            {
                ////if (intIndex >= 0)
                ////{
                //switch (e.CommandName)
                //{
                //    case "EditEmployee":
                //        int EditIndex = Convert.ToInt32("0" + e.CommandArgument.ToString());
                //        BizHR.BusinessLayer.HR.Employee employee = new BizHR.BusinessLayer.HR.Employee();
                //        Guid empID = (Guid)gvEmployee.DataKeys[EditIndex].Values["EmployeeId"];
                //        if (BizGridKeySelected != null)
                //        {
                //            BizGridKeySelected(this.gvEmployee, empID);
    
                //        }
                //        if (BizGridItemSelected != null)
                //        {
                //            List<Employee> lstEmployee = new List<Employee>();
                //            List<Employee> lstFilter = lstEmployee.Where(StringComparison.CurrentCultureIgnoreCase, "RowInactive==False").ToList<Employee>();
                //            lstEmployee = (new Employee()).GetByKeyId(empID);
                //            if (lstEmployee.Count > 0)
                //            {
                //                BizGridItemSelected(this.gvEmployee, lstEmployee[0]);
    
                //            }
                //            else
                //            {
                //                BizGridItemSelected(this.gvEmployee, null);
                //            }
                //        }
                //        break;
                //    case "DeleteEmployee":
                //        int DelIndex = Convert.ToInt32("0" + e.CommandArgument.ToString());
                //        _ItemToDelete.EmployeeId = (Guid)gvEmployee.DataKeys[DelIndex].Values["EmployeeId"];
                //        DeleteData(new System.IO.StringWriter());
                //        LoadData(new System.IO.StringWriter());
                //        break;
    
    
                //    default:
                //        break;
                //}
    
            }
    
            protected void gvEmployee_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                //if (this.IsForSelection)
                //{
                //    Control ctrl = (Control)e.Row.FindControl("btnActions");
    
                //    if (ctrl != null)
                //    {
                //        if (ctrl.Parent != null)
                //        {
                //            if (ctrl.Parent is DataControlFieldCell)
                //            {
                //                DataControlFieldCell dcfc = (DataControlFieldCell)ctrl.Parent;
                //                foreach (Control ctrl2 in dcfc.Controls)
                //                {
                //                    ctrl2.Visible = false;
                //                }
                //            }
                //        }
                //    }
                //}
            }
    
            protected void NewEventHandler(object sender, EventArgs e)
            {
                ////BizHR.BusinessLayer.Recruitment.HeadCountForm objHeadCountForm = new BizHR.BusinessLayer.Recruitment.HeadCountForm();
                ////if (BizNewItemSelected != null)
                ////{
                ////    objHeadCountForm.HeadCountFormName = string.Empty;
                ////    objHeadCountForm.NoOfApprovers = 0;
                ////    objHeadCountForm.HeadCountFormCode = string.Empty;
                ////    objHeadCountForm.DepartmentId = Guid.Empty;
    
                ////    //TODO: Company Id to be return directly from the login Details.
                ////    //objHeadCountForm.CompanyId =
                ////    BizNewItemSelected(this, objHeadCountForm);
                ////}
                //Employee objEmployee = new Employee();
                //{
                //    if (BizNewItemSelected != null)
                //    {
                //        objEmployee.EmployeeName = string.Empty;
                //        objEmployee.EmployeeId = Guid.Empty;
                //        objEmployee.EmployeeCd = string.Empty;
                //        objEmployee.FirstName = string.Empty;
                //        objEmployee.LastName = string.Empty;
                //        objEmployee.Mobile = string.Empty;
                //        objEmployee.OfficeEmail = string.Empty;
                //        objEmployee.PersonalEmail = string.Empty;
                //        objEmployee.employeeOfficialDetail = new EmployeeOfficeDetail();
                //        objEmployee.employeeNotes = new EmployeeNotes();
                //        objEmployee.DateOfBirth = DateTime.Now;
                //        objEmployee.Address = string.Empty;
                //        objEmployee.CountryId = 0;
                //        BizNewItemSelected(this, objEmployee);
                //    }
                //}
            }
            protected void Refresh(object sender, EventArgs e)
            {
                LoadData(new System.IO.StringWriter());
            }
    
            #region SelectionRelated Properties and Methods
            public bool IsForSelection
            {
                get
                {
                    if (ViewState["IsForSelection"] != null)
                        return (bool)ViewState["IsForSelection"];
                    else
                        return false;
                }
                set
                {
                    ViewState["IsForSelection"] = value;
                }
            }
    
            public List<ControlTest.Employee> GetSelectedEmployees()
            {
                List<ControlTest.Employee> lstRetval = new List<ControlTest.Employee>();
                //foreach (Bizbites.CustomControls.GridDataKey gdk in gvEmployee.PrepareSelectedDataKeys())
                //{
                //    Guid eId = (Guid)gdk["EmployeeId"];
                //    List<Employee> lstEmp = (new Employee()).GetByKeyId(eId);
                //    if (lstEmp.Count > 0)
                //    {
                //        lstRetval.Add(lstEmp[0]);
                //    }
                //}
    
                return lstRetval;
            }
    
            public void ClearSelection()
            {
                //gvEmployee.ClearSelection();
            }
            #endregion
        }
    }
    Please check!

    Regards,
    Gopal
Page 1 of 2 12 LastLast

Similar Threads

  1. Changing a row's text-decoration in a grid
    By Juls in forum 1.x Help
    Replies: 1
    Last Post: Nov 12, 2013, 11:48 PM
  2. Replies: 1
    Last Post: Sep 24, 2011, 10:52 PM
  3. [CLOSED] Grid Combo Editor - Make drop-down wider than column
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Aug 02, 2011, 3:05 PM
  4. Replies: 3
    Last Post: Jun 03, 2011, 12:10 PM
  5. Replies: 0
    Last Post: Jan 24, 2011, 12:10 PM

Posting Permissions