App design UI figure How to Add Excel like Sort & filter selection

29 vues (au cours des 30 derniers jours)
Life is Wonderful
Life is Wonderful le 21 Jan 2020
I want to add filter to my app design as shown in attachment
  • I have added my source *.mlapp file. For below code, I want to add excel like Sort & filter for all Columns Variables and Row Name data
TableCellData1 = timetable2table(joinedtimetable);
app.UITable.Data = TableCellData1;
t_table = app.UITable.Data(:,app.UITable.Data.Properties.VariableNames);
app.UITable.ColumnName = t_table.Properties.VariableNames;
app.UITable.RowName = 'numbered';
app.UITable.ColumnSortable = true;
app.UITable.BackgroundColor = [1 1 .9; .9 .95 1;1 .5 .5];
get(app.UITable);
% ui figure for viewing full logs
f_table = app.UITable.Data(:,app.UITable.Data.Properties.VariableNames);
fig = uifigure;
uit = uitable(fig,'Data',f_table,...
'ColumnName',f_table.Properties.VariableNames,...
'RowName',f_table.Properties.RowNames,...
'ColumnWidth',{100});
uit.RowName = 'numbered';
uit.ColumnSortable = true;
uit.BackgroundColor = [1 1 .9; .9 .95 1;1 .5 .5];
uit.Data = f_table;
styleIndices = ismissing(f_table);
[row,col] = find(styleIndices);
s = uistyle('BackgroundColor','black');
addStyle(uit,s,'cell',[row,col]);
uit.DisplayDataChangedFcn = @updatePlot;
set(uit, 'CellSelectionCallBack',[])
set(uit, 'CellSelectionCallBack',@selectionChangeCallBack);
Add Sort & Filter
'ColumnName',f_table.Properties.VariableNames,...
'RowName',f_table.Properties.RowNames,...
  2 commentaires
Adam Danz
Adam Danz le 21 Jan 2020
Modifié(e) : Adam Danz le 21 Jan 2020
There's currently no built-in methods of sorting and filtering UITables. You'll have to create these features manually.
sortrows may come in handy for simple alphanumeric sorting of the entire table based on a selected column.
For filtering, you can use logical indexing to select which rows should be displayed on the table. It won't be a very difficult task but it will take a bit of an investment of time. I'm sure you can find related questions within this forom on both filtering and sorting of UItables to get you started.
Life is Wonderful
Life is Wonderful le 24 Jan 2020
Modifié(e) : Life is Wonderful le 24 Jan 2020
Thanks a lot Adam for the suggestion. We can close this link . I am fine with your answer. I don't see accept answer button.

Connectez-vous pour commenter.

Réponse acceptée

Adam Danz
Adam Danz le 24 Jan 2020
My comment moved here to close out the question.
----------------------------------------------------------------
There's currently no built-in methods of sorting and filtering UITables. You'll have to create these features manually.
sortrows may come in handy for simple alphanumeric sorting of the entire table based on a selected column.
For filtering, you can use logical indexing to select which rows should be displayed on the table. It won't be a very difficult task but it will take a bit of an investment of time. I'm sure you can find related questions within this forom on both filtering and sorting of UItables to get you started.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by