Datatables FixedHeader sets columns to equal widths after scrolling is done - datatables

I initialize my HTML table using the columns option, so that I can set the widths for each indiviual column. Initially, fixedHeader preserves the specified columns widths, once I start scrolling. After I scroll all the way back up, to the point that 'fixedHeaders' are deactivated (no more sticky headers), the column widths are not preserved - but they are all set to equal widths.
Anybody have an idea on how can I force the column widths to be preserved?

You should set autoWidth option to false,as described here:autowidth . Then the related topics of :columns.adjust(). will be helpful too.

Related

How to make a table header fixed when scrolling in codename one

I need a scrolling table with a fixed header. I tried a borderlayout.center. and checked table scrolling methods , but failed. First row keep moving out of screen.
I really appreciate help.
Thank you
Essentially you create two tables and place one in the north and one in the center of a border layout. The north one contains only the header and the south one contains only the body.
The one important thing is to override the constraint method in the table and return identical values for cell widths. That way everything aligns.

Is it possible to set vb.net datagridview cell alignment without modifying whole column?

I am trying to set the alignment of a specific cell in a row/column to be right aligned. However I do not want to set the whole row, or whole column to right aligned. Is it possible to set the cell only? From what I've seen online I'm starting to think it isn't possible.
You would need to hook up to the RowDataBound event. This fires as each row is databound. Check that the row is a data row (as opposed to a header or footer). Then check the value in the column you are interested in. If the value meets your criteria for right justification then apply that to the column in question.
Note if you are using AlternateItemTemplate then check both Item rows and AlternateItem rows.
I've used this method to say change the backround colour of values that fall outside a range.

Getting table height dynamically in iText

Is there a way of getting the height of a table before adding it to the document?
At first glance, I supposed that the number of rows in the table is enough to calculate height since I know the font size. However, some rows break that rule. For instance, one cell might store a paragraph that has more than one line. Hence, what I need to know is the total of the heights of every row.
Yeah, answer was not complicated.
In order to get the height of a table, one must set the width of the table first. In other words,
table.setTotalWidth((PageSize.A4.getWidth() - document.leftMargin()
- document.rightMargin()) * table.getWidthPercentage() / 100);
System.out.println(table.calculateHeights());
does give the height of the table.
If you want to get table's height dynamically you can do so only after you have added all the content to it. In order to make this work you have to set its fixed width property and locked width property first.
e.g.
table.setTotalWidth(555f);
table.setLockedWidth(true);
after this you can get table's height by using its table.getTotalHeight() method

how to prevent some columns from being highlighted when selecting a row

I have a semi-dynamically created window ( and use PowerBuilder 10.5 ). Now there are a couple of columns which can have different colours and I want to see those colours when selecting a row. However I don't know how to deselect these columns and have the first couple of columns remain selected.
The highlight function in our application just does a dw.selectrow( x, true ).
Regards,
Marinus
I don't think you'll get what you want using selectrow. If you don't need multiple selections you could change the background of the current row with an expression in the datawindow. If you want some columns to stay normal you could do that with a rectangle behind the ones you want to highlight instead of changing the row color. If you need multiple rows highlighted you will have to simulate multi-select by adding a dummy column and using that to control the background, and of course you need to handle the selecting and deselecting in the clicked event. If you've got code that deals with selected rows you'll have to change them to use the new scheme, for example by checking the value in your dummy column.
If you want to use SelectRow(), maybe use of SetRowFocusIndicator() would help. IIRC (it's been pretty close to decade*s* since I've used it), it disables the row colouring in favour of the new method.
The other way that comes to mind is setting an expression for background colour that uses GetRow() and CurrentRow(). This wouldn't be my first choice, as it doesn't let users with vision impairment choose their colours through standard Windows colour selection to something they can deal with, but if you're dead set on colour indications on selective columns, this would be the way to go.
Good luck,
Terry.

Dojo Grid with editable and non-editable cells

We are using dojo 1.4.2 in our project. We have a page where we display a dojox.data.EnhancedGrid from ItemFileWriteStore. We have a use case based on the user access, we need to have a column editable for some rows; for rest of the rows this column should be read only.
So what we are looking at is setting the editable:true at the cell level and not at the column level. All the examples I see are set at the column level. Is there a way to set editable at the cell level?
I haven't found a way to set any options (such as editable) at the cell level. As far as I can tell, all options can only be set at the column level.