I have jqGrid which size is dynamically calculated on window resize as follows:
$(window).bind('resize', resizeTable);
function resizeTable(){
$("#jqGrid")
.setGridWidth($("#tableHolder").innerWidth()),
.setGridHeight($("#tableHolder").innerHeight());
};
Having constant rowNum, scroll bar appears on grid if y-size isn't enough to hold given number of rows.
I want rowNum to be calculated automatically to display only rows which fit in a visible area of the grid and make others move to next pages and have no scroll bar. Is that possible?
You don't included in your question how you calculate the size based on on window resize and which more important which options of jqGrid you set and when you set (in which callback/event).
In general one can either set height or rowNum. I personally prefer to specify rowNum (which value could be calculated based on the window resize) and to use height: "auto", which is default value of height in free jqGrid. As the result, the grid will never have vertical scroll bars.
Additionally I prefer to use top pager (toppager: true) instead of the botom pager (pager option) if the height of rows of the grid could be variable.
Related
I have a view with two vertically stacked Table Views. When I resize the application window, the lower table view expands. This is because I didn't specify a height for it. It has a fixed distance to the bottom of the window and a fixed distance to the table view above it. If I attempt to remove the fixed height for the upper table view, the constraints editor complains. Is it possible to have both table view expand equally when I resize the application? If not, is the possible to allow the upper table view to be resized when the application is running?
I found a way to do this as long as there is some sort of control between the two tables. A label will work fine. Using constaints:
For the control in between the two tables, set the Alignment constraint to "Vertically in Container. This will perfectly center the control. You can offset it above or below center by adding a positive or negative value in the combobox next to the option.
For the top table, pin the top of the box to the top of the window or any other place that fits your design.
Set the bottom constraint to some offset from the control in step 1.
Set the bottom constraint of the bottom table to something fixed like the bottom of the window.
Set the top constraint to some offset from the control in step 1.
Be sure not to set the height of either table.
When the window moves vertically, the control in step 1 will be moved to keep it in the center plus or minus any offset you provided. The two tables will be expanded or contracted accordingly.
I have made a window in which I will be having two groups/panels and some buttons in between them. I want to code the resizing behavior in a way that when the window expands, the two panels increase their widths while keeping the distance between them constant.
Please see this mockup:
As you see above, I want the 'Local' and 'Server' Panels to resize while keeping the distance in between them same. If I use anchors (Top+Left+Right+Bottom), the left panel will overlap the right one and the right's width one will go out of the window. I want them to share the increased width of the window equally.
As for the buttons in between, I have kept ancors as Top only. By removing Left anchor from button, it automatically places itself in the center of the window when window is expanded, which is just the way I want it to be.
Any ideas how to manage resizing of panels?
Thanks.
Use the TableLayoutPanel control.
First add the TableLayout to the Form and set its Dock() property to Fill.
Next you'll need to setup 3 columns and two rows. Add the two buttons to the middle column with each one is in its own row. Afterwards, setup the column values so they are like this:
Leave the rows at 50% on both.
Now add your two GroupBoxes to the 1st and 3rd columns in the 1st row.
For both GroupBoxes, set Dock() to Fill, and RowSpan() to 2.
For the top Button, turn on only the Bottom Anchor.
For the bottom Button, turn only the Top Anchor.
For the TableLayoutPanel, set Padding() to 5,5,5,5.
Here is what it looked like when I was all done:
Resize the window and observe how the controls behave...
Following this example - http://demos.kendoui.com/web/grid/detailtemplate.html, I have a grid and a tab strip inside the grid. One of the tabs has a grid within. This table is rather long, so I had to add a scrollbar. The grid overflows - though the scrollbar works, the data spills on to the next row, making the whole thing look ugly.
Is there any way to make the inner grid (the one within the tabstrip) not overflow?
I have seen this. Your parent has to grow to accommodate the last row. You can try placing the grid in a parent element and add a padding to the grid parent while setting the overflow to auto.
In slick grid, I can change the color of a specific row with:
$('.slick-row[row=2]').addClass('colorTest');
I wish to replace 2 with a variable in the command above.
Thanks for your help
Don't quite see what the problem is. Why can't you just do...
var i;
i = 2;
$('.slick-row[row=' + i + ']').addClass('colorTest');
This will not work. SlickGrid creates and removes DOM elements dynamically as you scroll, so if you do this, then scroll down a page and then scroll back up, your style will disappear.
SlickGrid defines an API for the data provider to specify CSS classes that should be applied to different rows and/or cells - https://github.com/mleibman/SlickGrid/wiki/Providing-data-to-the-grid.
I want a TableLayoutPanel with 2 Rows. The second row is 200px high. The first row the rest. If resize, only the first row resizes.
How to implement?
Anchor the TLP to the bottom. Click the tasks glyph (upper right corner), Edit rows and columns, Show = Rows, select the 2nd row and change the Size Type to Absolute.
Also note that you don't really need a TLP for this. Just use a regular Panel and dock or anchor the controls to the bottom.