Hello Arvind,
There is no simple way to accomplish this, but from a high level, here is my suggestion:
1. Any of the drop down items that require filtering, add an option to the list called 'Choose'.
2. In the "CellEditCallback", if the 'Choose' option was ever selected, launch a chooser window.
3. This chooser window (up to you), could have a dropdown, text edit, and OK button.
3.5 Pass all the menu options to the chooser window drop down. You can use the text edit to filter. Start typing, modify the edit text callback to filter out elements of the dropdown if they share a common stem. Then finally select an item from the drop down and click OK. Close the chooser window once you click 'OK'.
4. Transmit the data back to your original UI, and set the Table value to your filtered selection.
The following code works in R2016b and after, and can be used as an example of the above workflow:
% Create sample table
fmt = {'Choose' 'B' 'C' 'D'};
t = uitable('Data',{'A';'A'},...
'ColumnEditable',true(1,2),...
'ColumnFormat',{fmt});
% Set callback for CellEditCallback, triggered on menu item changed
t.CellEditCallback = @EditCallback;
function EditCallback(tHandle, event)
if (event.EditData == 'Choose')
% Create a chooser window
chooseFig = figure;
b = uicontrol(chooseFig, 'Style','pushbutton',...
'String', 'Click Me',...
'Callback',@pushbutton_callback);
% Launch new Figure
% event.Indices is the Row/Col to edit
% event.NewData has the new data
disp('Getting Val from Figure');
% On Figure 'OK' button, set the row/col
waitfor(chooseFig);
disp('Wait Done! Setting Value');
end
function pushbutton_callback(hChooser,~)
% Get the data out of hChooser
idx = event.Indices;
tHandle.Data(idx(1), idx(2)) = {'NewData'};
% Close the popup window
delete(hChooser.Parent);
end
end
This will launch a new figure window when you select 'Choose' and once you click the OK button, it will return and restore the value 'New Value' to the original UI Table
Hope this helps!
Best, Kevin