私のテストコードは以下のとおりです。
<script type="text/javascript">
Ext.onReady(function() {
Ext.create('Ext.button.Button', {
id: "Button",
renderTo: Layer
});
});
function SetPixelWidth() {
var button = Ext.getCmp("Button");
button.setWidth(200);
}
function SetPercentageWidth() {
var button = Ext.getCmp("Button");
button.setWidth("50%");
}
</script>
<button onclick="SetPixelWidth()">Set Width(Pixel)</button>
<button onclick="SetPercentageWidth()">Set Width(Percentage)</button>
<div id="Layer" style="width:100%;background:black"></div>
setWidth(200)
正常に動作しますが、「setWidth( "50%")」は有効になりません。
幅をpercentage
または他の単位で設定するにはどうすればよいpixel
ですか?
よろしくお願いします!