handsontable row height doesnt match when using column freeze - handsontable

when I used column freeze option I had this problem. Row height is okay when the cell only contain single line words like
"Amy should look around for any last items, notice the surfboard and then move to it."
but when the words become like this (have multiple line) the column freeze's row have different height :
"Amy should look around for any last items, notice the
surfboard and then move to it."

Yes, I used to have this same problem and I'd wager you're using Bootstrap and have checkboxes in your code. If not, it may not be the same problem.
If it is, then you have to go into the Bootstrap code and remove the css that adds margins to checkboxes. That fixed it for me and should be entered as a bug in the git repo.

You can prevent this behaviour by enabling AutoRowSize plugin (autoRowSize: true)
Source: https://github.com/handsontable/handsontable/issues/493#issuecomment-155519503
If that does not work on it's own, try using both autoRowSize: true and autoColumnSize: true

Related

Storing extra value for cells on iGrid 4

In one of my apps I'm still using the very old iGrid OCX version 4.
Upgradig to iGrid 6 is currently not an option for me.
I've desperately tried to find any way to store 2 extra strings in a Cell. They should not appear as a cell text.
The first thing I tried to do was assign a class to "CellValue" instead of "CellText", but it wouldn't be accepted.
Then I tried something something really dirty: I have simply added a hundred spaces and my 2 extra string, separated by a special char so that I could split them up later.
This however resulted in "..." being displayed on the cell texts. I could work around this by assigning textdraw flags to the cell, but when I hover over the cell, the entire string is shown again. I wanted to hide it.
Updating to version 6 or even iGrid.NET (where I could simply use CellTag or assign as class to a cell) is currently not an option for me.
Thank you for any help!
Aaaaahhhhh. :-D I got it:
I could simply (ab)use the "CellCtrlKey" property of a cell to store the additional strings.
Edit: Hmmm, I can set this value, but it gets ignored, meaning when I retrieve it, it is "" again.
I guess that is a value that can only be used when a cell is a checkbox cell.
Edit 2: I haven't found any way, so I now use a matrix / array of string, string that stores these extra values.
I'm also using iGrid.NET and iGrid6 in other projects, and in these versions, it's super easy, but as I explained, for this one project I can't upgrade.

How to make tablix expand towards the left?

I have a tablix, one with dynamic columns. The order is fine ("total" shows up last) but the problem is that, for scanning purposes, the last column needs to always be aligned right and any additional columns have to be to the left of that origin point. How to accomplish this?
I've tried setting the "Direction" of the column to RTL and tried putting another object on the right of the tablix but that just gets pushed to the right for every extra column. Is there some sort of anchor property I'm missing or something that'll keep the tablix from growing on the right side?
There aren't any properties that allow you to dynamically change the width of columns or the position of tables etc. As a table grouping grows, it pushes other elements out of the way. First thing to try is put both of the tables in a rectangle. This can help keep them in position.
Another option is to use visibility to change where your values appear, while maintaining the same underlying layout. Depending on the specifics of how you're trying to lay things out, this may be difficult to use for your purposes.

Jqgrid After setting width of column, and then try to click column separator causes the column resize back to the newWidth

Here i am having problem with grid column resize.
The actual functionality i want to achieve is that i want to reset the grid column widths to some default values on click of buttons.
I successfully changed the width of column using some code, but the problem is arise now.
The problem is after resetting the column widths (i.e. setting column width) and then when i Just click on column separator causes column width change to previously set width (i.e. newwidth).
I illustrate the problem by showing images.
Just consider the images in sequence as they shown.
1. Before resizing the column.
2. After resizing the column.
3. Now reset width to default width.
4. Now just click on separator. This will cause the column to be resized again to previous state before we reset. and also causes undesired behavior when dragging as you see in next pic.
5. Width increased and undesired behavior when dragging.
I tried many things. I also found this : jQuery grid plugin - triand
But unfortunately no solution provided in it.
By using that reference, i tried to setting newWidth to 0, -1, undefined and moreover i removed it from headers. but all the things not working.
I can't understand what is happening.
Please note that there is no chance that some undesired code in project resided somewhere else causes this behavior. For the test i tried using new version of jqgrid 4.5.1, but in that also happening the same.
Please someone provide me solution for this. I am tired as i am doing this thing from many days. I am very much thankful to the one who help me.
Thank You in Advance !
I am not sure how you implemented "reset width to default width", but I hope two things should help you.
First of all jqGrid have bug in resizing of columns which looks exactly like on the "Step 5" which you described. I posted the pull request which merged to the main code of jqGrid about one month ago. You can do the same changes (two lines need be change) you your copy of jquery.jqGrid.src.js (see here details of the changes).
To implement resetting of width of columns to default width you can use the following. First you can use widthOrg of elements of colModel. After resizing of any column the original value of width will be saved in widthOrg. To change the column width one can use setColWidth method which I suggested in the resent answer.
I hope you will able to solve you problem using widthOrg, setColWidth and the bug fix bescribed above.

List Control Adds a Space for an Image to Column 0 When Subsequent Columns Have Images

I’ve come across a problem with Windows list controls (I am specifically using MFC, but it looks like it applies to all list controls in the Windows common controls library).
In my specific case, I want to create a list control that has two or more columns. The first column (0) is text-only and is used to allow the user to jump to entries by typing the text in that row. Column two (or three, or four, or whatever) has an image (or an image and text; either way).
This much is all well and good and can be done easily without problem, however the final list control then ends up having a space to the left of the text in column 0 (it may be on the right on an RTL system). This spacer appears to be reserved for an image and I cannot figure out a way to prevent it. (Arranging the specific order of the columns did not change anything.)
Looking around, I found some other people complaining of the same thing, specifically this thread which leads to this thread. The proposed solution does not work because as was stated, simply shrinking the width of column zero merely cuts off the text rather than the image spacer (plus, you then have to prevent and/or process any changes to column widths that the user tries to make).
Does anyone have any ideas of how to fix this bug short of writing a list control from scratch or using one of the too-fancy grid controls on CodeProject/CodeGuru/etc.?
Thanks a lot.
Did you try to change the iIndent member of the LVITEM struct? MSDN says this:
iIndent Version 4.70. Number of image widths to indent the item. A
single indentation equals the width of
an item image. Therefore, the value 1
indents the item by the width of one
image, the value 2 indents by two
images, and so on. Note that this
field is supported only for items.
Attempting to set subitem indentation
will cause the calling function to
fail.
Column 0 is special in a ListView. As soon as you assign a small image list to the ListView, the control expects you to show an image in column 0, so it leaves space for it.
Solutions:
make column 0 zero-width, give it the value you want the user to be able to type. Column 1 becomes your "first" text column. Columns 2+ are for your images. You need full row select style for this to work. Yes, you have to prevent the user from resizing column 0. Yes, that is a pain.
make a column that does have an image to be column 0 and use LVM_SETCOLUMNORDERARRAY to rearrange the display order
owner draw the items.
give column 0 an icon (just to cover all bases)

Win32 List-View Control SubItem padding for custom-drawn SubItems?

When using custom-draw (NM_CUSTOMDRAW) to draw the entire contents of a ListView SubItem (in Report/Details view), it would be nice to be able to apply the same left and right
padding in my custom paint method that is applied by the control itself for non-custom-drawn items.
Is there a way to programmatically retrieve this padding value? Is it
related to the width of a particular character (" " or "w" or something?) or
is it a fixed value (6px on left and 3px on right or something) or...?
EDIT: To clarify, I want to add the same padding to my NM_CUSTOMDRAWn SubItems that the control adds to items that it draws, and the metric that I'm looking for, for example, is the white space between the beginning of the 2nd column and the word "Siamese" in the following screenshot (Note: screenshot from MSDN added to help explain my question):
(source: microsoft.com)
Note that the word "Siamese" is aligned with the header item ("Breed"). I would like to be able to guarantee the same alignment for custom-drawn items.
use ListView Header message HDM_GETBITMAPMARGIN
see link text
ListView_GetSubItemRect (LVM_GETSUBITEMTECT)
http://msdn.microsoft.com/en-us/library/ms930172.aspx
Despite what the documentation says I suspect LVIR_LABEL returns just the returns the bounding rectangle of the item text, as per ListView_GetItemRect.
(This just kept niggling me as I though I had actually seen an answer somewhere when playing with NM_CUSTOMDRAW).
Edit After Comment 2:
I imagine you have seen NMLVCUSTOMDRAW which if you are willing to use Version 6.0. has rcText. I wouldn't since I use Win2K.
Given what you have found I would go back to the suggestion of using
ListView_GetItemRect to get LVIR_LABEL and compare that with LVIR_BOUNDS and use the difference.
the way for doing this is retrieving the format of the corresponding column with
ListView_GetColumn()
then check the retrieved myLVCOLUMN.mask
LVCOLUMN myLVCOLUMN;
myLVCOLUMN.mask=LVCF_FMT;
ListView_GetColumn(hwnd,nCol,&myLVCOLUMN);
then when we draw the corresponding label belonging to that column
if(myLVCOLUMN.fmt & LVCFMT_CENTER)
DrawText(x,x,x,x, DT_CENTER | DT_WORD_ELLIPSIS );
else if (myLVCOLUMN.fmt & LVCFMT_RIGHT)
DrawText(x,x,x,x, DT_RIGHT | DT_WORD_ELLIPSIS );
else
DrawText(x,x,x,x, DT_LEFT | DT_WORD_ELLIPSIS );
I would assume that GetSystemMetrics() is that you need to look at. I think that SM_CXEDGE and SM_CYEDGE are probably the values you want, but don't quote me on that. ;-)
Can only guess without seeing your output.
A few suggestions: If you are using the DrawTextEx function, have you have experimented with DT_INTERNAL et al?
Are you accidentally putting in a blank image/icon.
Does it look ok in classic screen mode? If so I would look at XP Theme functions to see if some thing is going on.
Late edit after first comment:
I wonder if the size of rectangle matches the space required for the LVN_ENDLABELEDIT edit box around the text so the text doesn't move (or for a focus rectangle)?
I guess you could compare the result of LVM_GETITEMRECT with LVIR_LABEL on the first column and use the difference as your left border.

Resources