Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    I can not select text in a ListGrid with Chrome

    Hi,

    I am using SmartGwt-4.0p.

    Code:
    listTextos = new ListGrid();
    listTextos.setSelectionType(SelectionStyle.SINGLE);
    listTextos.setSelectionAppearance(SelectionAppearance.ROW_STYLE);
    listTextos.setCanSelectAll(true);
    listTextos.setCanSelectText(true);
    listTextos.setCanDragSelectText(true);
    listTextos.setShowHeader(false);       
    listTextos.setAutoFetchData(false);
    listTextos.setDataSource(dsTextos);
    listTextos.setCanEdit(false);
    listTextos.setShowAllRecords(true);
    listTextos.setWrapCells(true);
    listTextos.setFixedRecordHeights(false);
    listTextos.setEmptyMessage("<i>No hay textos disponibles para esta anotación.</i>");
    listTextos.setFields(getListGridFields());
    listTextos.addSelectionChangedHandler(new SelectionChangedHandler() {
                @Override
                public void onSelectionChanged(SelectionEvent event) {
                    if (event.getState()) {                   
                        //Edición
                        if (event.getRecord().getAttribute("usu_modificacion").compareTo(operador.getAlias()) == 0) {
                            grTextos.setDisabledEditar(false);
                        } else {
                            grTextos.setDisabledEditar(true);
                        }
                    } else {
                        grTextos.setDisabledEditar(true);
                    }
                }
            });
    The control listGrid only has a visible column that I formatted content in a html table.
    Code:
    private ListGridField[] getListGridFields() {
    
            List<ListGridField> listGridFields = new ArrayList<ListGridField>();
    
            //idTexto
    		ListGridField idTexto = new ListGridField("id_texto", "IdTexto");
    		idTexto.setHidden(true);
    		idTexto.setCanHide(false);		
            listGridFields.add(idTexto);
    
            //Texto
    		ListGridField texto = new ListGridField("texto", "Texto");
    		texto.setWidth("*");
    		texto.setType(ListGridFieldType.TEXT);
    		texto.setCellFormatter(new CellFormatter() {
    			@Override
    			public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
    
    				String sTexto = "<table width='100%'>";
    
    				// <editor-fold defaultstate="collapsed" desc="Row 1">
    
    				sTexto += "<tr style='background-color:#FCF0AD'>";
    				sTexto += "<th text-align='left' width='10%'>" + "De:" + "</th>";
    				sTexto += "<td width='25%'>";
    				sTexto += record.getAttribute("usu_modificacion") + " (" + record.getAttribute("gop_padre") + ")";
    				sTexto += "</td>";
    				sTexto += "<th text-align='left' width='10%'>" + "Fecha:" + "</th>";
    				sTexto += "<td width='25%'>" + record.getAttribute("fecha") + "</td>";
    				sTexto += "<th text-align='left' width='10%'>" + "Tipo:" + "</th>";
    				sTexto += "<td width='20%'>" + record.getAttribute("tipo") + "</td>";
    				sTexto += "</tr>";
    
    				// </editor-fold>
    
    				// <editor-fold defaultstate="collapsed" desc="Row 2">
    
    				if (EnumSiNo.getItem(record.getAttribute("visible"))) {
    					sTexto += "<tr style='background-color:#FCF8E1'>";
    				} else {
    					sTexto += "<tr>";
    				}
    				sTexto += "<td colspan= '6'>" + String.valueOf(value) + "</td>";
    				sTexto += "</tr>";
    
    				// </editor-fold>
    
    				sTexto += "<hr>";
    				sTexto += "</table>";
    
    				return sTexto;
    			}
    		});
    		
    		listGridFields.add(texto);
    
            return listGridFields.toArray(new ListGridField[listGridFields.size()]);
    }
    In FF and IE if I select the text (FF.png), however in Chrome if I try dragging select a word, just select a letter and can not select more content (Chrome.png).
    Attached Files
    Last edited by acens; 28 Mar 2014, 04:40.

    #2
    Any solution for this issue? We have exactly the same problem.

    Comment

    Working...
    X