uitable: Can the headers be made clickable?

I would like to sort the entries in a table by by clicking on the column header for the variable I want to sort. Is there a way to make the headers clickable in uitable?

답변 (2개)

Walter Roberson
Walter Roberson 2011년 2월 23일

1 개 추천

... '<HTML><A HREF="matlab:sort_by_col1">'
In theory. In practice I had trouble with this sort of thing in the cell entries.

댓글 수: 4

Andrew Newell
Andrew Newell 2011년 2월 23일
How does that work?
Walter Roberson
Walter Roberson 2011년 2월 23일
uitable('Data',{1 2; 3 4;5 6}, 'ColumnName', {'<HTML><A HREF="matlab:disp(''col1'')">A</A>', '<HTML><A HREF="matlab:disp(''col2'')">B</A>'})
This will produce the appearance of hyperlinks in the column names, but at least in 2008b I cannot get the links to function, and there is no indication that the link is clickable.
There is an undocumented property of uitable (in 2008b anyhow) called Sortable, default 'off', can be set to 'on'. It doesn't appear to do anything.
People have asked for the same thing in the past; the responses I found have all indicated that it cannot be done. But I didn't read through Yair's site.
Andrew Newell
Andrew Newell 2011년 2월 23일
Ditto on all counts for 2010b. I haven't found anything on Yair's site. I don't understand where names like "sort_by_col1" or "col1" are coming from.
Walter Roberson
Walter Roberson 2011년 2월 23일
sort_by_col1 would be a call that matlab would execute due to the matlab: URI prefix.
disp('col1') is a trial action just to see if the link is working.

댓글을 달려면 로그인하십시오.

Andrew Newell
Andrew Newell 2011년 2월 23일

0 개 추천

A reasonable substitute for clicking on the column headers would be to create a context menu using UIContextMenu. But clicking on the column headers is so intuitive!

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2011년 2월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by