webgrid events dropdownlist change

1 reply. Last post: August 12, 2013 2:57 AM by Hans Kristian
Tags :
  • New Discussion
  • New Question
  • New Product Feedback

Hi,

I need to set editable/not editable some cells(NUM_SCAGL,COD_UNIONE,TP_CLIENTE, NUM_PUNTI,SCNT_VAL) after the change value of a cell set as a dropdown list (Tipologia-->TIPL_DE).

I use onAfterExitEditMode but if i press tab botton the cursor goes to the first editable cell set from the previous value choose in dropdownlist and not in the new.

How can i solve this problem?


Bye,

Paola


DROPDOWNLIST:
if (headerGroup.childNodes[0].childNodes[0].childNodes[0].childNodes[i].innerText.match("Tipologia") == "Tipologia") {
            headerGroup.childNodes[0].childNodes[0].childNodes[0].childNodes[i].childNodes[0].innerHTML =
                    "Tipologia <input id=\"btnColGroupTipl\" class=\"btnColGroup\" type=\"button\" value=\"" + value + "\" onclick=\"javascript:btnColGroupClickTipl()\" />";
            grid.RootTable.UpdateUI();
        }
WEBGRID:
<ISWebGrid:WebGridColumn Caption="Tipologia" DataMember="TIPL_DE" Name="TIPL_DE"
                                AllowMultiLine="true" Width="80px" EditType= "DropdownList" FilterEditType="TextBox">                                
                                <CellStyle CssClass="columnTextDisabled">
                                </CellStyle>
                            </ISWebGrid:WebGridColumn>
                                                                              
                            <ISWebGrid:WebGridColumn Caption="Scaglione" DataMember="NUM_SCAGL" Name="NUM_SCAGL" AllowMultiLine="true"
                                Width="1px" FilterEditType="TextBox" EditType="DropdownList" >
                                <CellStyle CssClass="columnDisabled">
                                </CellStyle>
                            </ISWebGrid:WebGridColumn> 
                            <ISWebGrid:WebGridColumn Caption="Codice unione" DataMember="COD_UNIONE" Name="COD_UNIONE" AllowMultiLine="true"
                                Width="1px" FilterEditType="TextBox" TextboxMaxlength=3>
                                <CellStyle CssClass="columnDisabled">
                                </CellStyle>
                            </ISWebGrid:WebGridColumn>
                            <ISWebGrid:WebGridColumn Caption="Tipo cliente" DataMember="TP_CLIENTE" Name="TP_CLIENTE"
                                EditType="DropdownList" AllowMultiLine="true" Width="1px" FilterEditType="TextBox">
                                <CellStyle CssClass="columnTextDisabled">
                                </CellStyle>
                            </ISWebGrid:WebGridColumn>                              
                            <ISWebGrid:WebGridColumn Caption="Numero punti" DataMember="NUM_PUNTI" Name="NUM_PUNTI" AllowMultiLine="true"
                                Width="1px" FilterEditType="TextBox" DataType="System.Integer" >
                                <CellStyle CssClass="columnDisabled">
                                </CellStyle>
                            </ISWebGrid:WebGridColumn> 
                            <ISWebGrid:WebGridColumn Caption="Sconto a valore" DataMember="SCNT_VAL" Name="SCNT_VAL" AllowMultiLine="true"
                                Width="1px" FilterEditType="TextBox" DataType="System.Decimal"   >
                                <CellStyle CssClass="columnDisabled">
                                </CellStyle>
ONAFTEREXITEDITMODE:
function onAfterExitEditMode(controlId, tblName, editObject)
    {
        var WebGrid1 = ISGetObject(controlId);   
        var cell = wgGetCellByElement(editObject.cellElement);                   
        var selRow = cell.Row;
        //Giuseppe Caranfa 29/04/2011: acquisisco il contenuto della riga selezionata per ogni singola cella
        //                             In tutta la funzione cells.GetNamedItem è stato sostituito con selRow.GetCell
        //var cells = selRow.GetCells();
        var intPrenTotForn = selRow.GetCell("QT_PREN_TOTL").Value;                        
        if(editObject.ToCellObject().Name == "QT_PREN_TOTL")
        {
            //arrotondo al multiplo di uxi
            intPrenTotForn = editObject.element.value;  
            intPrenTotForn = Number(intPrenTotForn);                        
            //var uxi = selRow.GetCells().GetNamedItem("NU_PEZZ_COLL").Value;                
            var uxi = selRow.GetCell("NU_PEZZ_COLL").Value;                
            intPrenTotForn = ValidateQtPren(intPrenTotForn,uxi);            
            if(cell.Modified == true)
            {
                selRow.GetCell("QT_PREN_TOTL").SetText(intPrenTotForn.toString(),true, true);
                selRow.GetCell("QT_PREN_TOTL").SetValue(intPrenTotForn.toString(),true);                                                                     
            }
        } 
        
        //valido lo sconto promo
        if(editObject.ToCellObject().Name == "SCNT_PROMO" || editObject.ToCellObject().Name == "TP_SCNT_PROMO")
        {
            
            //var tp_sconto = selRow.GetCells().GetNamedItem("TP_SCNT_PROMO").Value;
            var tp_sconto = selRow.GetCell("TP_SCNT_PROMO").Value;
            if(editObject.ToCellObject().Name == "TP_SCNT_PROMO")
                tp_sconto_promo = editObject.element.value;
            //var sconto_promo = selRow.GetCells().GetNamedItem("SCNT_PROMO").Value;        
            var sconto_promo = selRow.GetCell("SCNT_PROMO").Value;        
            if(editObject.ToCellObject().Name == "SCNT_PROMO")
                sconto_promo = editObject.element.value;
            //var costo_netto = selRow.GetCells().GetNamedItem("COST_NETT_STD").Value;
            var costo_netto = selRow.GetCell("COST_NETT_STD").Value;
            costo_netto = Number(costo_netto.replace(",","."));
            if(tp_sconto == '€')
            {
                if(sconto_promo > costo_netto)
                {
                    sconto_promo = costo_netto;  
                    selRow.GetCell("SCNT_PROMO").SetText(sconto_promo.toString().replace(".",","),true, true);
                    selRow.GetCell("SCNT_PROMO").SetValue(sconto_promo.toString().replace(".",","),true);
                    //if(cell.Modified == true)
                    //    ErrorMessage("0","Attenzione: stai inserendo uno sconto promo maggiore del costo netto standard","");   
                }
                                                
            }
            if(tp_sconto == '%')
            {
                if(sconto_promo > 100) 
                {        
                    sconto_promo = 100;
                    selRow.GetCell("SCNT_PROMO").SetText(sconto_promo.toString().replace(".",","),true, true);
                    selRow.GetCell("SCNT_PROMO").SetValue(sconto_promo.toString().replace(".",","),true);
                    //if(cell.Modified == true)
                    //    ErrorMessage("0","Attenzione: stai inserendo uno sconto promo maggiore del costo netto standard","");
                }
            }
            /*if(sconto_promo != "")
            {
                cells.GetNamedItem("SCNT_PROMO").SetText(sconto_promo.toString().replace(".",","),true, true);
                cells.GetNamedItem("SCNT_PROMO").SetValue(sconto_promo.toString().replace(".",","),true);     
            }*/
        }
        //selRow.AddPendingChanges();
        //Paola Tripolisi 23/07/2013: gestione nuove dinamiche promo abilitazione per tipologia
        if (editObject.ToCellObject().Name == "TIPL_DE") 
        {   
            var tp_sconto = selRow.GetCell("TP_SCNT_PROMO").Value;
            if (editObject.ToCellObject().Name == "TP_SCNT_PROMO")
                tp_sconto_promo = editObject.element.value;
                            
            var tiplCd = selRow.GetCell("TIPL_DE").Value;
            switch (tiplCd) {
                case "4": case "6":case "7":  //MxN
                    selRow.GetCell("NUM_SCAGL").SetForceNoEdit(true);
                    selRow.GetCell("NUM_SCAGL").SetText("", true, true);
                    selRow.GetCell("NUM_SCAGL").SetValue("", true);
                    selRow.GetCell("NUM_SCAGL").CellElement.style.backgroundColor = "#EEECE1";
                    
                    selRow.GetCell("COD_UNIONE").SetForceNoEdit(false);
                    selRow.GetCell("COD_UNIONE").CellElement.style.backgroundColor = "#FFFFFF";
                    
                    selRow.GetCell("TP_CLIENTE").SetForceNoEdit(true);
                    selRow.GetCell("TP_CLIENTE").SetText("", true, true);
                    selRow.GetCell("TP_CLIENTE").SetValue("", true);
                    selRow.GetCell("TP_CLIENTE").CellElement.style.backgroundColor = "#EEECE1";
                    
                    selRow.GetCell("NUM_PUNTI").SetForceNoEdit(true);
                    selRow.GetCell("NUM_PUNTI").SetText("", true, true);
                    selRow.GetCell("NUM_PUNTI").SetValue("", true);
                    selRow.GetCell("NUM_PUNTI").CellElement.style.backgroundColor = "#EEECE1";
                    
                    selRow.GetCell("SCNT_VAL").SetForceNoEdit(true);
                    selRow.GetCell("SCNT_VAL").SetText("", true, true);
                    selRow.GetCell("SCNT_VAL").SetValue("", true);
                    selRow.GetCell("SCNT_VAL").CellElement.style.backgroundColor = "#EEECE1";
                    break;
                case "9": //SCONTAPUNTI
                    selRow.GetCell("NUM_SCAGL").SetForceNoEdit(true);
                    selRow.GetCell("NUM_SCAGL").SetText("", true, true);
                    selRow.GetCell("NUM_SCAGL").SetValue("", true);
                    selRow.GetCell("NUM_SCAGL").CellElement.style.backgroundColor = "#EEECE1";
                    selRow.GetCell("COD_UNIONE").SetForceNoEdit(true);
                    selRow.GetCell("COD_UNIONE").SetText("", true, true);
                    selRow.GetCell("COD_UNIONE").SetValue("", true);
                    selRow.GetCell("COD_UNIONE").CellElement.style.backgroundColor = "#EEECE1";
                    selRow.GetCell("TP_CLIENTE").SetForceNoEdit(false);
                    selRow.GetCell("TP_CLIENTE").SetText("", true, true);
                    selRow.GetCell("TP_CLIENTE").CellElement.style.backgroundColor = "#FFFFFF";
                    
                    selRow.GetCell("NUM_PUNTI").SetForceNoEdit(false);
                    selRow.GetCell("NUM_PUNTI").CellElement.style.backgroundColor = "#FFFFFF";
                    
                    selRow.GetCell("SCNT_VAL").SetForceNoEdit(false);
                    selRow.GetCell("SCNT_VAL").CellElement.style.backgroundColor = "#FFFFFF";
                    break;
                case "10": //PIUCOMPRIMENOSPENDI
                    selRow.GetCell("NUM_SCAGL").SetForceNoEdit(false);
                    selRow.GetCell("NUM_SCAGL").CellElement.style.backgroundColor = "#FFFFFF";
                    
                    selRow.GetCell("COD_UNIONE").SetForceNoEdit(false);
                    selRow.GetCell("COD_UNIONE").CellElement.style.backgroundColor = "#FFFFFF";
                    selRow.GetCell("TP_CLIENTE").SetForceNoEdit(false);
                    selRow.GetCell("TP_CLIENTE").SetText("", true, true);
                    selRow.GetCell("TP_CLIENTE").CellElement.style.backgroundColor = "#FFFFFF";
                    selRow.GetCell("NUM_PUNTI").SetForceNoEdit(true);
                    selRow.GetCell("NUM_PUNTI").SetText("", true, true);
                    selRow.GetCell("NUM_PUNTI").SetValue("", true);
                    selRow.GetCell("NUM_PUNTI").CellElement.style.backgroundColor = "#EEECE1";
                    selRow.GetCell("SCNT_VAL").SetForceNoEdit(true);
                    selRow.GetCell("SCNT_VAL").SetText("", true, true);
                    selRow.GetCell("SCNT_VAL").SetValue("", true);
                    selRow.GetCell("SCNT_VAL").CellElement.style.backgroundColor = "#EEECE1";
                    break;
                default:
                    selRow.GetCell("NUM_SCAGL").SetForceNoEdit(true);
                    selRow.GetCell("NUM_SCAGL").SetText("", true, true);
                    selRow.GetCell("NUM_SCAGL").SetValue("", true); 
                    selRow.GetCell("NUM_SCAGL").CellElement.style.backgroundColor = "#EEECE1";
                    
                    selRow.GetCell("COD_UNIONE").SetForceNoEdit(true);
                    selRow.GetCell("COD_UNIONE").SetText("", true, true);
                    selRow.GetCell("COD_UNIONE").SetValue("", true);
                    selRow.GetCell("COD_UNIONE").CellElement.style.backgroundColor = "#EEECE1";
                    
                    selRow.GetCell("TP_CLIENTE").SetForceNoEdit(true);
                    selRow.GetCell("TP_CLIENTE").SetText("", true, true);
                    selRow.GetCell("TP_CLIENTE").SetValue("", true);
                    selRow.GetCell("TP_CLIENTE").CellElement.style.backgroundColor = "#EEECE1";
                    
                    selRow.GetCell("NUM_PUNTI").SetForceNoEdit(true);
                    selRow.GetCell("NUM_PUNTI").SetText("", true, true);
                    selRow.GetCell("NUM_PUNTI").SetValue("", true);
                    selRow.GetCell("NUM_PUNTI").CellElement.style.backgroundColor = "#EEECE1";
                    
                    selRow.GetCell("SCNT_VAL").SetForceNoEdit(true);
                    selRow.GetCell("SCNT_VAL").SetText("", true, true);
                    selRow.GetCell("SCNT_VAL").SetValue("", true);
                    selRow.GetCell("SCNT_VAL").CellElement.style.backgroundColor = "#EEECE1";
                    break;
            } //chiusura switch
        }
    
        if (editObject.ToCellObject().Name == "NUM_SCAGL") 
        {
            var scagl = selRow.GetCells().GetNamedItem("NUM_SCAGL").Value;
            var lung = scagl.length;
            if (lung == 1) {
                if (scagl <= 0 || scagl > 5) {
                    selRow.GetCell("NUM_SCAGL").SetText("", true, true);
                    selRow.GetCell("NUM_SCAGL").SetValue("", true);
                }
                else selRow.GetCell("NUM_SCAGL").SetValue(Number(scagl), true);
            }
            else {
                selRow.GetCell("NUM_SCAGL").SetText("", true, true);
                selRow.GetCell("NUM_SCAGL").SetValue("", true);
            }
        }
        
        if (editObject.ToCellObject().Name == "COD_UNIONE") 
        {
            var unione = selRow.GetCells().GetNamedItem("COD_UNIONE").Value;
            var lung_un = unione.length;
            if (lung_un >= 1 && lung_un <= 3) {
                unione = str_pad_left(unione, "0", 3);
                selRow.GetCell("COD_UNIONE").SetText(unione, true, true);
            }
            else {
                selRow.GetCell("COD_UNIONE").SetText("", true, true);
                selRow.GetCell("COD_UNIONE").SetValue("", true);
            }
        }
    }

 


All times are GMT -5. The time now is 4:32 AM.
Previous Next