Por lo tanto, me baso en mis pruebas anteriores en nuestro proyecto usando Zing Grid api y estoy buscando una manera de eliminar la API de eliminación incorporada que aparece cuando selecciona un conjunto de columnas con el atributo type="selector" :
Cuando configuro el texto del subtítulo personalizado, el botón API desaparece, pero esto también elimina el cuadro de búsqueda. ¿Cómo elimino el botón Eliminar API?
const zgRef = document.querySelector('zing-grid#zgRefTable'); zgRef.querySelector("zg-caption").textContent = "Custom Text"; Cómo borrar el conjunto de atributos de las columnas seleccionadas con type="selector" después de ejecutar el método refresh() :
Escucho el evento row:select y rowIndex el índice de fila en una matriz y justo antes de ejecutar el método refresh() borro la propiedad zing-grid aSelectedRows . Esto parece un poco raro. ¿Cómo borro las filas seleccionadas?
var rowIdx = []; // Row select event zgRef.addEventListener('row:select', function(e) { e.preventDefault(); const checked = e.detail.ZGData.checked; const idx = e.detail.ZGData.rowIndex; if (checked && !rowIdx.includes(idx)) { rowIdx.push(idx); } else if (!checked && rowIdx.includes(idx)) { rowIdx = rowIdx.filter(x=>x!=idx); } }); // Refresh button document.getElementById("refreshBtn").addEventListener("click", (e)=>{ e.preventDefault(); if (rowIdx.length>0) { rowIdx.forEach((element)=>{ // reset selected rows before refresh const r = zgRef.row(element); r.widget.aSelectedRows = []; }); rowIdx = []; } zgRef.refresh(); // refresh }); Si selecciona una columna, la API cambia automáticamente el título a x Item Selected . ¿Cómo configuro un texto de subtítulo personalizado que sobrescriba el texto del x Item Selected ? Probé el método setCaption() pero concatena el texto existente a api Custom Text\nx Item Selected text.
var customTxt = "Custom Text" // Tried zgRef.setCaption(customTxt); // Also tried zgRef.querySelector("zg-caption").textContent = customTxt; // This changes the text but removes search box