Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Refresh listgrid data only for a row.

$
0
0
We have a ListGrid within a custom field created as from certain values. In function of theses values we show one or other imgButton (with its corresponding onclick function type) and the same for the background color of the row.
Once you have clicked on any imgButton, we do several process which makes update sentences in database, etc... up here it's all right, but we must refresh the listGrid, and for customer requirements, we can't do this by fetchData sentence because this way refresh all grid, and only must be refreshed the row which was clicked in the imgButton.
How can we make this? And how can we get refresh the row components such as imgButton and row color style without to do a fetchData?

Our code is as follows:
Code:

isc.ListGrid.create({
        ID:"grdAlbaranes", 
        autoDraw:false,
        autoFetchData:false,
        showRecordComponents: true,
        showRecordComponentsByCell: true,
        showFilterEditor:true,
        autoFitFieldWidths:false,
        wrapCells: false,
        dataSource:"ref:attevccamionalbaranesDS",
        hoverWidth:150,
        cellHeight:16,
        fixedRecordHeights:true,
        canEdit:false,
        fields:[{
                        name:"botones",
                        width:60,
                        title: " ",
                        canFilter:false
                },{
                        name:"ALBS_ID",
                        width:80,
                        showHover:true,
                        hoverHTML: function (record, value, rowNum, colNum, grid){
                                  if ((record.IND_DECISION == "S") && (record.IND_INCIDENCIA == "S")){
                                          return cargaCamionUIDS.getField("hover.expedicion.faltasIncidencias").title;
                                  } else  if (record.IND_DECISION == "S") {
                                          return cargaCamionUIDS.getField("hover.expedicion.faltas").title;
                                  } else  if ((record.IND_FALTA == "S") && (record.IND_INCIDENCIA == "S")) {
                                          return cargaCamionUIDS.getField("hover.expedicion.faltasIncidencias.NoBuscando").title;
                                  } else  if (record.IND_FALTA == "S") {
                                          return cargaCamionUIDS.getField("hover.expedicion.faltas.NoBuscando").title;
                                  } else if (record.IND_INCIDENCIA == "S") {
                                          return cargaCamionUIDS.getField("hover.expedicion.incidencias").title;
                                  } else if (record.ESTADO == "P") {
                                          return cargaCamionUIDS.getField("hover.expedicion.pantalla").title;
                                  }else {
                                          return cargaCamionUIDS.getField("hover.expedicion.correcta").title;
                                  } 
                        }
                },{
                        name:"IND_PARCIALES",
                        width:40
                },{
                        name:"SERV_ID",
                        width:35
                },{
                        name:"CLEM_ID_RMTE",
                        width:80
                },{
                        name:"CLRG_ID_RMTE",
                        width:80
                },{
                        name:"CLEM_ID_CONS",
                        width:80
                },{
                        name:"CLRG_ID_CONS",
                        width:80
                },{
                        name:"DIRECCION_CONS",
                        width:150
                },{
                        name:"POBLACION_CONS",
                        width:120
                },{
                        name:"PLZS_ID_ORG",
                        title:"Org",
                        width:40
                },{
                        name:"PLZS_ID_DES",
                        title:"Des",
                        width:40
                },{
                        name:"TOT_BULTOS_CARGA",
                        width:60
                },{
                        name:"NUM_BULTOS_ESCANEADOS",
                        width:60
                },{
                        name:"NUM_BULTOS_ESC_ANTES",
                        width:60
                },{
                        name:"PESO_CARGADO",
                        width:80
                },{
                        name:"VOLUMEN",
                        width:50
                },{
                        name:"IND_INCIDENCIA",
                        width:40
                },{
                        name:"IND_GENERAR_FALTA_TOTAL",
                        width:60
        }],
        getCellCSSText: function (record, rowNum, colNum) {
                if ((record.IND_DECISION == "S") && (record.IND_INCIDENCIA == "S")) {
                        return "background-color:#F8DFFF;";
                } else  if (record.IND_DECISION == "S") {
                        return "background-color:#FFFF99;";
                } else  if ((record.IND_FALTA == "S") && (record.IND_INCIDENCIA == "S")) {
                        return "background-color:#C0C0F0;";
                } else  if (record.IND_FALTA == "S") {
                        return "background-color:#FFD675;";
                } else if (record.IND_INCIDENCIA == "S") {
                        return "background-color:#D0A9F5;";
                } else if (record.ESTADO == "P") {
                        return "background-color:#99CCCC;";
                }else {
                        return "background-color:white;";
                }
        }, 
        initialSort:[{
                        property:"IND_DECISION",
                        direction:"descending"
        },{
                        property:"IND_FALTA",
                        direction:"descending"
        },{
                        property:"IND_INCIDENCIA",
                        direction:"descending"
        },{
                        property:"CLEM_ID_RMTE",
                        direction:"ascending"
        },{
                        property:"ALBS_ID",
                        direction:"ascending"
        }],
  /**
  *  SUBGRID Bultos de Albaranes
  */
  canExpandRecords: true,
  expansionMode: "related",
  detailDS:"ref:attevccamionbultosDS",
  expansionCanEdit : false,
  createRecordComponent : function (record, colNum) { 
        var fieldName = this.getFieldName(colNum); 

        if (fieldName == "botones") {
                if ((record["NUM_BULTOS_ESCANEADOS"] == 0) && (record["IND_FALTA"] == "S") && (record["BULTOS_FPARCIAL"] == 0)){ 
                        var recordFalta = isc.HLayout.create({
                                height: 16,
                                width:40,
                                align: "center"
                        });
                        if (record["ESTADO"] == "A") { 

                                var aceptarFaltaTotal = isc.ImgButton.create({
                                                showDown: false,
                                                showRollOver: false,
                                                layoutAlign: "center",
                                                src: Page.getAppImgDir()+"/delete2.png",
                                                prompt: cargaCamionUIDS.getField("prompt.boton.aceptarFaltaTotal").title,
                                                height: 16,
                                                width: 16,
                                                grid: this,
                                                visible: true,
                                                click : function () {
                                                        miGrid = this.parentElement.parentElement.parentElement;
                                                        albsId = miGrid.getRecord(miGrid.getEventRow()).ALBS_ID;
                                                        ccamId = miGrid.getRecord(miGrid.getEventRow()).CCAM_ID;
                                                        filaSeleccionada = miGrid.getEventRow();
                                                        isc.confirm(cargaCamionUIDS.getField("mensaje.confirm.generar.incTotal").title,
                                                                          "marcarFaltaTotal(value, filaSeleccionada)",
                                                                          {toolbarButtons : [Dialog.YES, Dialog.NO, Dialog.CANCEL] }
                                                        );
                                                }
                                });
                                recordFalta.addMember(aceptarFaltaTotal);

                        } else if (record["ESTADO"] == "F") {

                                var quitarFaltaTotal = isc.ImgButton.create({
                                                showDown: false,
                                                showRollOver: false,
                                                layoutAlign: "center",
                                                src: Page.getAppImgDir()+"/delete_verde.png",
                                                prompt: cargaCamionUIDS.getField("prompt.boton.quitarFatltaTotal").title,
                                                height: 16,
                                                width: 16,
                                                grid: this,
                                                visible: true,
                                                click : function () {

                                                        miGrid = this.parentElement.parentElement.parentElement;
                                                        albsId = miGrid.getRecord(miGrid.getEventRow()).ALBS_ID;
                                                        ccamId = miGrid.getRecord(miGrid.getEventRow()).CCAM_ID;
                                                        filaSeleccionada = miGrid.getEventRow();
                                                       
                                                        isc.confirm(cargaCamionUIDS.getField("mensaje.confirm.quitar.incTotal").title,
                                                                          "quitarFaltaTotal(value, filaSeleccionada)"
                                                        ); 
                                                }
                                });
                                recordFalta.addMember(quitarFaltaTotal);
                        }
                        return recordFalta; 

                } else { 
                        return null; 
                        }       
                } else { 
                        return null; 
                }       
        }
})

Thanks in advance.

We are working under:
v9.1p_2014-05-04/PowerEdition Development SC and IExplrorer 10.0.9200 navigator, Eclipse Helios and Tomcat 7.0.28

Viewing all articles
Browse latest Browse all 4756

Trending Articles