I have QTreeWidget containing 5 columns. I want to remove column from the tree when user uses remove column menu. How can I remove column from the tree?
If it's purely for UI purposes you can hide the corresponding section in the QHeaderView used by your tree view:
treeview->header()->hideSection(4)
I know this is an old one, but the solution was rather simple.
QTreeWidget::setColumnCount( 0 );
They reload the headerLabels using
QTreeWidget::setHeaderLabels
This will make sure the the "removed" column is actually removed
Related
I have a basic 2 column table for a form. In the left column are the labels, and in the right column are the inputs. When the user submits the form, if there are errors I want to display them directly to the right of the input in which the error was relating to. Could anyone provide an example of how to position a div next to the table row without shifting the columns across?
You could have the <div> representing the error inside of the <tr>. If there is no error it could just be empty. You can use a js templating framework like Mustache.js to pass arguments into your <div>.
I would encourage the use of Flex Grid. This is a CSS ruleset that will help you layout your form. You can still use two column format, with the only change being the you will probably want to reduce the size of the first column relative to the second column, to leave room for an error message.
Another option would be to use abandon tables and use CSS Grids instead.
Take a look at these links for more information:
http://flexboxgrid.com/
https://css-tricks.com/dont-overthink-flexbox-grids/
https://css-tricks.com/snippets/css/complete-guide-grid/
I would like to create a mdl-data-table such that when I click on it.
My guess is just to add a row with colspan == number of columns when I choose to expand the row. I was wondering if there was a better version than that. Something that makes it look like that it is expanded with some existing styles rather than creating a new style.
In addition, if it can be "animated" as a slide down that pushes the other elements that would be a bonus.
Note the answer does not have to handle the clicking part, but just the "expanded" part
I have list of items with alternating background colors. I'm currently using the :nth-child(odd) selector to make the alternating row colors. Users have the ability to add new items to the top of the list asynchronously using jquery -- this poses an issue that makes the form a bit unintuitive:
When a new entry is added to the top of the list, all the previously existing rows gets pushed down by one, so they all change alternating colors (since odd rows become even, and vice versa). I'd like to keep the existing alternating colors when a new row is added -- one way to do it would be to calculate odd/even nth-child starting from the bottom of the list... Any way to do this?
Additional info: New entries must be added to 'top' of list. Adding "odd"/"even" class names to rows not practical in this case.
Thanks in advance!
You will want to use the :nth-last-child(2n+0). This is working from the last child instead of the first/newest child. Hope this helps.
I'm using an AdvancedDataGrid without the header row (AdvancedDataGrid.showHeaders="false"), my AdvancedDataGrid has 2 columns, where the first one will show a hierarchical data (tree).
The tree may be very long and very deep or may contain a long string in the node label so the user will not be able to see the whole vale of the tree node, I want to be able to resize the column using the vertical separator of the gris (the one displayed/separates between columns) or to be able to define a horizontal scroll bar only for the first column!
How can I accomplish this?!....Any idea ?!
Try to set the Advanced Datagrid tag's attribute 'wordWrap="true"'.
HI
I am new to Flex and was wondering, when we use an advanced data grid, only when we click on the parent element the children details get populated in the corresponding columns, right?..SO now i have made the empty columns invisible(at design) now how do i make them visible at run time when the parent element is expanded..similarly once the columns are visible, how can i make them invisible again when the parent element is closed.
Please help me out
Thanks
I think the event you want to listen for is "itemOpen" then the function you want will be something like:
MyADG.columns[invisible column index].visible=true;