private void SetEditor()
    {
        this.Store2.DataSource = new List <object> {
            new { name = "Ca 1" }, new { name = "Ca 2" }, new { name = "Ca 3" }
        };
        this.Store2.DataBind();

        foreach (var col in GridPanel1.ColumnModel.Columns)
        {
            //   Ext.Net.MultiCombo cbWorkingStatus = new MultiCombo();
            Ext.Net.MultiCombo cbWorkingStatus = new MultiCombo();
            cbWorkingStatus.StoreID        = "Store2";
            cbWorkingStatus.Width          = 60;
            cbWorkingStatus.ListWidth      = 300;
            cbWorkingStatus.ID             = "cb" + col.ColumnID;
            cbWorkingStatus.TypeAhead      = true;
            cbWorkingStatus.ForceSelection = true;
            cbWorkingStatus.SelectionMode  = MultiSelectMode.Selection;
            cbWorkingStatus.DisplayField   = "name";
            cbWorkingStatus.ValueField     = "name";
            cbWorkingStatus.Editable       = false;
            cbWorkingStatus.Mode           = DataLoadMode.Local;
            cbWorkingStatus.ItemSelector   = "tr.list-item";

            cbWorkingStatus.Template.Html = @"
                                            <tpl for=""."">
						                        <tpl if=""[xindex] == 1"">
							                        <table class=""cbStates-list"">
								                        <tr>
									                        <th>Tên ca</th>
									                        <th>Giờ làm việc</th>
								                        </tr>
						                        </tpl>
						                        <tr class=""list-item"">
							                        <td style=""padding:3px 0px;"">{name}</td>
							                        <td>{name}</td>
						                        </tr>
						                        <tpl if=""[xcount-xindex]==0"">
							                        </table>
						                        </tpl>
					                        </tpl>
                                            ";

            if (col.ColumnID.StartsWith("Ngay"))
            {
                col.Editor.Add(cbWorkingStatus);
                col.DataIndex = "name";
            }
        }
    }
Esempio n. 2
0
        public static List <int> ObtenerIds(this MultiCombo c)
        {
            List <int> rtn;

            try
            {
                rtn = (from o in c.SelectedItems select int.Parse(o.Value)).ToList <int>();
            }
            catch
            {
                rtn = new List <int>();
            }
            return(rtn);
        }
    // Initialize controls
    public override void InitShadow(System.Web.UI.WebControls.ContentPlaceHolder oContentPage)
    {
        #region begin

        lblSite     = (Hidden)oContentPage.FindControl("lblSite");
        lblBu       = (Hidden)oContentPage.FindControl("lblBu");
        lblBuilding = (Hidden)oContentPage.FindControl("lblBuilding");


        txtFormNo   = (TextField)oContentPage.FindControl("txtFormNo");
        txtCustomer = (TextField)oContentPage.FindControl("txtCustomer");
        txtDate     = (TextField)oContentPage.FindControl("txtDate");
        txtNotes    = (TextArea)oContentPage.FindControl("txtNotes");

        cmbPhase      = (ComboBox)oContentPage.FindControl("cmbPhase");
        cmbPlant      = (ComboBox)oContentPage.FindControl("cmbPlant");
        cbProductType = (ComboBox)oContentPage.FindControl("cbProductType");
        txtModel      = (TextField)oContentPage.FindControl("txtModel");;
        cmbLayout     = (MultiCombo)oContentPage.FindControl("cmbLayout");;

        txtPM    = (TextField)oContentPage.FindControl("txtPM");
        txtRD    = (TextField)oContentPage.FindControl("txtRD");
        txtSales = (TextField)oContentPage.FindControl("txtSales");
        txtNextStage_BeginDate = (DateField)oContentPage.FindControl("txtNextStage_BeginDate");
        ConAttachment          = (Container)oContentPage.FindControl("ConAttachment");


        cmbPM       = (ComboBox)oContentPage.FindControl("cmbPM");
        cmbRD       = (ComboBox)oContentPage.FindControl("cmbRD");
        cmbSales    = (ComboBox)oContentPage.FindControl("cmbSales");
        txtPMExt    = (NumberField)oContentPage.FindControl("txtPMExt");
        txtRDExt    = (NumberField)oContentPage.FindControl("txtRDExt");
        txtSalesExt = (NumberField)oContentPage.FindControl("txtSalesExt");

        pnlCountersign    = (Panel)oContentPage.FindControl("pnlCountersign");
        grdResult         = (GridPanel)oContentPage.FindControl("grdResult");
        btnDelete         = (Button)oContentPage.FindControl("btnDelete");
        cmbAttachmentType = (ComboBox)oContentPage.FindControl("cmbAttachmentType");
        btnDelete         = (Button)oContentPage.FindControl("btnDelete");
        grdAttachment     = (GridPanel)oContentPage.FindControl("grdAttachment");

        pnlResult         = (Panel)oContentPage.FindControl("pnlResult");
        rgResult          = (RadioGroup)oContentPage.FindControl("rgResult");
        txtReslutOpinion  = (TextArea)oContentPage.FindControl("txtReslutOpinion");
        rdResultY         = (Radio)oContentPage.FindControl("rdResultY");
        rdResultN         = (Radio)oContentPage.FindControl("rdResultN");
        rdReulutCondition = (Radio)oContentPage.FindControl("rdReulutCondition");
        #endregion
    }
        private AbstractComponent GetMultiComboBoxValues(FilterHtmlGenerator.Filter filterData, out PickerFieldListeners listeners)
        {
            var multiComboBox = new MultiCombo(StandartConfigMultiComboBoxItems())
            {
                ID           = RegistrationControlToRepository(UniquePrefixes.MultiBoxFilterValues, filterData),
                ClientIDMode = ClientIDMode.Static,
            };

            multiComboBox.ListConfig.Listeners.ItemMouseLeave.Handler = string.Format("{0}.itemLeave = index; window.setTimeout(function() {{ if ({0}.itemLeave == index) {0}.collapse(); }}, 400);", multiComboBox.ClientID);
            multiComboBox.ListConfig.Listeners.ItemMouseEnter.Handler = string.Format("{0}.itemLeave = -1;", multiComboBox.ClientID);
            if (!filterData.IsMultipleSelect)
            {
                multiComboBox.Listeners.BeforeSelect.Handler = "item.clearValue(); window.setTimeout(function() {item.collapse(); }, 100);";
            }
            listeners = multiComboBox.Listeners;
            return(multiComboBox);
        }
    public void ClearControl(Control control, bool setcolor)
    {
        TextField     tf  = control as TextField;
        NumberField   nf  = control as NumberField;
        TextArea      ta  = control as TextArea;
        SpinnerField  sf  = control as SpinnerField;
        Checkbox      cb  = control as Checkbox;
        DropDownField ddf = control as DropDownField;
        ComboBox      cbb = control as ComboBox;
        DateField     df  = control as DateField;
        TriggerField  tgf = control as TriggerField;
        MultiCombo    mc  = control as MultiCombo;

        if (setcolor)
        {
            if (tgf != null)
            {
                tgf.Reset(); tgf.StyleSpec = "color:black";
            }
            if (df != null)
            {
                df.Reset();
                df.Call("setMaxValue", null);
                df.Call("setMinValue", null);
                df.StyleSpec = "color:black";
            }
            if (mc != null)
            {
                mc.Reset(); mc.StyleSpec = "color:black";
            }
            if (cbb != null)
            {
                cbb.Reset(); cbb.StyleSpec = "color:black";
            }
            if (ddf != null)
            {
                ddf.Reset(); ddf.StyleSpec = "color:black";
            }
            if (cb != null)
            {
                cb.Reset(); cb.StyleSpec = "color:black";
            }
            if (sf != null)
            {
                sf.Reset(); sf.StyleSpec = "color:black";
            }
            if (ta != null)
            {
                ta.Reset(); ta.StyleSpec = "color:black";
            }
            if (nf != null)
            {
                nf.Reset(); nf.StyleSpec = "color:black";
            }
            if (tf != null)
            {
                tf.Reset(); tf.StyleSpec = "color:black";
            }
            if (control.HasControls())
            {
                foreach (Control child in control.Controls)
                {
                    ClearControl(child, setcolor);
                }
            }
        }
        else
        {
            if (tgf != null)
            {
                tgf.Reset();
            }
            if (df != null)
            {
                df.Reset();
                df.Call("setMaxValue", null);
                df.Call("setMinValue", null);
            }
            if (mc != null)
            {
                mc.Reset();
            }
            if (cbb != null)
            {
                cbb.Reset();
            }
            if (ddf != null)
            {
                ddf.Reset();
            }
            if (cb != null)
            {
                cb.Reset();
            }
            if (sf != null)
            {
                sf.Reset();
            }
            if (ta != null)
            {
                ta.Reset();
            }
            if (nf != null)
            {
                nf.Reset();
            }
            if (tf != null)
            {
                tf.Reset();
            }
            if (control.HasControls())
            {
                foreach (Control child in control.Controls)
                {
                    ClearControl(child, setcolor);
                }
            }
        }
    }