Uitable: deleting row selected problem

7 visualizaciones (últimos 30 días)
David
David el 4 de Ag. de 2013
Hi mates
I am having trouble when deleting a selected row in a uitable. My problem is that if i delete the last row, when i reinitialize the table it says the index is out of bounds, as the previous selection is not erased. My question would how to change the user selection once i have deleted the row.
Thanks you in advance
  3 comentarios
David
David el 4 de Ag. de 2013
Editada: Azzi Abdelmalek el 4 de Ag. de 2013
This is the callback of the cell Selection, nothing special
% --- Executes when selected cell(s) is changed in uitableTodosSetup.
function uitableTodosSetup_CellSelectionCallback(hObject, eventdata, handles)
% hObject handle to uitableTodosSetup (see GCBO)
% eventdata structure with the following fields (see UITABLE)
% Indices: row and column indices of the cell(s) currently selecteds
% handles structure with handles and user data (see GUIDATA)
indices=eventdata.Indices;
handles.editSetupColumnaSeleccionada=indices(2);
guidata(hObject, handles);
And then if you push the Delete button:
% --- Executes on button press in pushbuttonEditarSetupEliminar.
function pushbuttonEditarSetupEliminar_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonEditarSetupEliminar (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
tableModelPanelEditarSetup=TableModelPanelEditarSetup();
tableModelPanelEditarSetup.eliminarSetup(handles.editSetupColumnaSeleccionada,handles.coche,handles.uitableTodosSetup);
%Actualizo el coche seleccionado
cocheDAO=CocheDAO();
handles.coche=cocheDAO.buscarPorId(get(handles.coche,'id'));
guidata(hObject,handles);
I think it is more useful the description rather the code itself.
dpb
dpb el 4 de Ag. de 2013
Reformat the code to be legible...then the code will be useful. :)
It takes code to see what actually is going on; descriptions of intent are valuable for context but rarely are sufficient to diagnose a problem. Among the most important of the reasons why is that if the person w/ the problem understood the problem well enough to describe it in sufficient precision as to allow the solution then they could solve it themselves 'cuz there wouldn't be a problem. :)

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by