Why kendo grid shown to me like this:
If you are resizing the grid manually, you must resize both the grid and data-area height. If you have a tool bar, you may also need to take this into account. Try this when you are resizing your grid:
var gridElement = $("#gridElementName");
var dataArea = gridElement.find(".k-grid-content");
var toolbar = gridElement.find(".k-toolbar");
var thead = gridElement.find("table[role='grid'] thead");
var newGridHeight;
var newDataAreaHeight;
newGridHeight = $(document).height() - offsetValueOne;
newDataAreaHeight = newGridHeight - toolbar.height() - thead.height() - offsetValueTwo;
dataArea.height(newDataAreaHeight);
dataArea.css("max-height", newDataAreaHeight);
gridElement.height(newGridHeight);
OffsetValueOne should be larger than OffsetValueTwo. In your code, it seems that the data-area and the grid height are not matching up correctly. Hope this helps. Good luck.
Related
Why when creating a button with a script in the function _ready, these buttons cannot be resized. (And position)
var pos
var siz
var yBut = 150
var but
func _ready():
siz = get_viewport().get_visible_rect().size
pos = get_viewport().get_visible_rect().position
but = Button.new()
$sc/vb.add_child(but, true)
but.rect_position = pos/2
but.rect_size = Vector2(siz.x, 150)
ps. The buttons are placed in a ScrollContainer in which the vBoxContainer.
Container controls will auto resize and position children controls. Try using the Button's size flags to suggest it's size.
You can also compose ui with multiple levels of other Container controls such as V and HBoxContainer using size flags. This will give you finer control over the whole look of the ui. This will also make it easier to add controls later that will adaptively resize.
You can also set rect_min_size and the Container will not resize it any smaller than min size. However, that may break dynamic layout.
Hope this helps!
I followed the tutorial on creating a popup for an add-on in Firefox, and it worked great.
The issue I'm having now is that the popup it creates doesn't change size to fit the content I add to it. Instead, it adds scroll bars.
So, how do I change the size of a Firefox Add-on SDK popup to show all content?
You do have to deal with that yourself.
If you already know the desired size when creating the panel, you can pass the height and width as properties of the object to the Panel() constructor.
After a panel is created, its size can be changed by setting the height and width properties on it.
height and width values are numbers in pixels.
See https://developer.mozilla.org/en-US/Add-ons/SDK/High-Level_APIs/panel for a full documentation of how to use panels.
Though the tutorial and docs never say it, the height and width of a panel always defaults to the same small size.
To change it you can use the height and width parameters for the panel class.
If you want it to change automatically you can use this code:
//index.js
var panel = require("sdk/panel").Panel({
height: 200, //choose your default
width: 200,
contentURL: data.url("popup.html"),
contentScriptFile: data.url("auto_resize_popup.js")
});
panel.port.on("resize", function (size) {
console.log(size);
panel.resize(size.width, size.height);
});
...
//auto_resize_popup.js
var content = document.body;
var size = {};
size.width = content.offsetWidth + 2; //2 extra pixels get rid of scroll bars
size.height = content.offsetHeight + 2;
self.port.emit("resize", size);
I'm new to SO, but I've been learning to code for the past couple years. I just launched my webpage and everything looks good except for the About/Contact page.
There isn't enough content for the footer to stick to the bottom and the Sticky Footer code makes it always present. I only want it to be at the bottom of the page and underneath content. It looks fine on small browsers but not on larger screens or when you zoom out.
Positioning absolute and fixed doesn't work, and bottom: 0 doesn't work either. I'm running out of ideas on how to stick it to the bottom.
Any ideas???
Here's my site: http://yasminpanjwani.com/aboutcontact.html
Thanks!
You could calculate the height of the viewport and set a min-height to your main element
If your using jQuery
$(document).ready(function() {
var viewportHeight = $(document).height();
$('main').css('min-height', viewportHeight - 200 ); // minus size of your header & footer
});
If not;
var $main = document.getElementsByTagName('main'),
body = document.body,
html = document.documentElement;
var height = Math.max(
body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight
);
$main.style.minHeight = height + 'px';
I am New In sencha -touch and need your help.
I add new panel and want to set the height of this panel in css.
this.clockContainer = new Ext.Panel({
id:'clock',
html:'00:00'
});
#clock {height:142px}
however,sencha calculates the height style to 91px (according to the html content) and ignores my css.
I dont want to add the height property to the panel like this:
this.clockContainer = new Ext.Panel({
id:'clock',
html:'00:00',
height:'142px'
});
what can I do?How can I prevent sencha calculates the height?
thank you.
edit: if I set the height property to '142px' it works fine but if I set it to '8.06em' senchs ignores it and calculate itself.
You need to add a cls attributes to your Ext.Panel like so
this.clockContainer = new Ext.Panel({
id:'clock',
html:'00:00',
cls:'clock-panel'
});
Then in your CSS you add this
.clock-panel .x-panel-body{
height:142px;
}
Hope it helps
I am trying to display a bytearray as a resized image. The Image is displaying correctly, but the sizing is off. Let me explain.
First I have the image data encoded so I need to decode the image data
// Instantiate decoder
var decoder:Base64Decoder = new Base64Decoder();
// Decode image data
decoded.decode(picture.data);
// Export data as a byteArray
var byteArray:ByteArray = decoder.toByteArray();
// Display image
var img:Image = new Image();
img.load(byteArray);
This works. The image is displayed correctly. However, if I hardcode the image (img) height the resized image is shown correctly, but within a box with the original image's dimensions.
For example, if the original image has a height of 300px and a width of 200px and the img.height property is set to 75; the resized image with height of 75 is shown correctly. But the resized image is shown in the upper left corner of the img container that is still set to a height of 300px and a width of 200px. Why does it do that? And what is the fix?
The best way to illustrate the problem is by placing the image inside a VBox and show the borders of the VBox. From the code block above, if I change the image height and set the image to maintain aspect ratio (which by default is set to true but I add it here for completeness). the problem becomes clear.
// Display image
var img:Image = new Image();
img.height = 75; // Hardcode image height (thumbnail)
img.maintainAspectRatio = true;
img.load(byteArray);
// Encapsulate the image inside a VBox to illustrate the problem
var vb:VBox = new VBox();
vb.setStyle('borderStyle', 'solid');
vb.setStyle('borderColor', 'red');
vb.setStyle('borderThickness', 2);
vb.addChild(img);
I have been working on this problem for days and cannot come up with a solution. Any ideas? What am I missing?
The workaround I used is as follows:
I created an event listener for the img display object. Then after the img has loaded, I manually set the height and width of the image. I know what I want the height (preHeight) to be so that is hardcoded. I then calculate the width and set that as the image width. For some reason I had to use the explicitHeight and explicitWidth properties to finally get the sizing right.
I hope this helps someone.
img.addEventListener(FlexEvent.CREATION_COMPLETE, onCreationComplete);
private function onCreationComplete(event:FlexEvent) : void
{
img.addEventListener(Event.COMPLETE, onImageLoadComplete);
}
private function onImageLoadComplete(event:Event) : void
{
var image:Image = event.currentTarget as Image;
var preHeight:Number = 0;
var h:uint = Bitmap(image.content).bitmapData.height;
var w:uint = Bitmap(image.content).bitmapData.width;
// Check height
preHeight = h > 170 ? 170 : h;
// Set the width
img.explicitWidth = (preHeight * w)/h;
img.explicitHeight = preHeight;
}