Alr1976 Posted July 10, 2025 Posted July 10, 2025 Hi, It Possible to have Multiselect on TUniStringGrid? Br,Alessandro
Sherzod Posted July 11, 2025 Posted July 11, 2025 4 hours ago, Alr1976 said: Yes May I ask what is the goal of selecting multiple cells in your case?
Alr1976 Posted July 11, 2025 Author Posted July 11, 2025 I need to insert tasks to be done in multiple cells at the same time. I can't use cell by cell, it's not user friendly.
Sherzod Posted July 11, 2025 Posted July 11, 2025 Do you mean selecting a continuous range of cells (like in Excel), or selecting individual cells separately using Ctrl+Click?
Alr1976 Posted July 14, 2025 Author Posted July 14, 2025 If possible, I would like to implement both options. If that's not possible, at least one of the two options.
Sherzod Posted July 15, 2025 Posted July 15, 2025 19 minutes ago, Alr1976 said: Any News? Hello, I understand your interest in getting a quick solution, and we all try to help each other here as much as possible. However, please keep in mind that not all questions get an instant or complete answer on the forum. Sometimes it takes time and effort to find or test a working solution. For your first scenario (selecting a range of cells), I recommend checking this post: You can analyze how to get the selected cells, but you will need to do some additional research and adjustments to fully implement the required logic. For the second scenario (selecting arbitrary cells), you can analyze the cellclick event, and try to add/remove a custom selection class on click. Later, you can collect all selected cells by their class name. These are just some hints to point you in the right direction. Hope this helps a bit.
Alr1976 Posted July 25, 2025 Author Posted July 25, 2025 Hi! Ok now i can select multiple cells. How can know which cells are selected? Br,Alessandro
Sherzod Posted July 25, 2025 Posted July 25, 2025 Hello, 1 hour ago, Alr1976 said: Ok now i can select multiple cells. How can know which cells are selected? On 7/15/2025 at 3:23 PM, Sherzod said: ...but you will need to do some additional research and adjustments to fully implement the required logic.
Alr1976 Posted July 25, 2025 Author Posted July 25, 2025 ok, I need to know RangeSelection. How to implement it? i tried: function selectionchange(model, selected, eOpts) { // 'model' è il SelectionModel. La griglia è accessibile tramite la sua view. // Questo è il metodo più affidabile per ottenere il riferimento alla griglia. var grid = model.view.ownerGrid; // Se 'grid' fosse ancora undefined, un'alternativa è usare il parametro 'selected'. // L'oggetto 'selected' (Ext.grid.selection.Cells) ha un riferimento al suo selModel. if (!grid && selected && selected.view) { grid = selected.view.ownerGrid; } // Se dopo entrambi i tentativi la griglia non è definita, usciamo per sicurezza. if (!grid) { console.error('uniGUI Error: Could not get a reference to the grid.'); return; } // Controlliamo che 'selected' sia un oggetto di selezione celle valido. if (!selected || !selected.isCells) { ajaxRequest(grid, 'cellSelection', ['[]']); return; } var cells = selected.getCells(); var selectedData = []; var store = grid.getStore(); var columns = grid.getColumns(); for (var i = 0; i < cells.length; i++) { var cellCoord = cells[i]; var rowIndex = cellCoord[0]; var colIndex = cellCoord[1]; if (rowIndex < store.getCount() && colIndex < columns.length) { var record = store.getAt(rowIndex); var fieldName = columns[colIndex].getDataIndex(); var cellValue = record.get(fieldName); selectedData.push({ row: rowIndex, col: colIndex, value: cellValue }); } } var jsonData = Ext.JSON.encode(selectedData); ajaxRequest(grid, 'cellSelection', [jsonData]); } But doesn' t works tks,Alessandro
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now