当前位置:首页 > AI娱乐 > 正文内容

extjs layout fit LearningExtJS(FourthEdition)

admin12小时前AI娱乐3

extjs layout fit LearningExtJS(FourthEdition)

The

One of the of the Ext JS is the to in an easy way. We can fixed or fluid using the right .

At this point, you know how a works. We can the of a by a . If we don't a to our , by the auto will be used. In our , we used the auto and as we could see, the or HTML are one after .

There are many we can use to our , such as , cards, , and so on.

We can find all the in the Ext.. . Go to the and look into the enum class: .

Here we will see many , each a type of . Some of the most are:

The

The pides the space into five ( panes): north,southextjs layout fit, west,east, and . We can place our in any of the , but we are to use the .

In the code, we will the as . We will also the , west, and south for the :

Ext.onReady(function(){
  Ext.create('Ext.panel.Panel', {
    width: 500,  height: 300,
    title:  'Border Layout',
    layout: 'border',
    items: [{
      xtype: 'panel',
      title: 'South Region is resizable',
 region: 'south', // region
      height: 100,
 split: true // enable resizing
    },{
      xtype: 'panel',
      title: 'West Region',
 region:'west', // region
      width: 200,
 collapsible: true, //make panel/region collapsible
      layout: 'fit',
 split: true // enable resizing
    },{
      title: 'Center Region',
 region: 'center',
      layout: 'fit',
      margin: '5 5 0 0',
      html:'Main content goes here'
    }],
    renderTo: Ext.getBody()
  });
});

We have made the West a panel. If we click on the small arrow in the or in the bar, we'll see that the panel will to the left-hand side. Also, we have our South panel to be split. This us to the South panel by the bar with our mouse.

Note

You can place (s) that a in order to avoid over- of .

The Fit

This is to be used for only one child. It us to the inner to the size of the . The child takes all the space in the . When the is , the child size is too to fit the new . Let's make the code for this :

Ext.onReady(function(){
  var win = Ext.create("Ext.window.Window",{
    title: "My first window",
    width: 300,
    height: 200,
    maximizable: true,
 layout: "fit",
    defaults: {
    xtype: "panel",
    height: 60,
    border: false
    },
    items: [
    {title: "Menu", html: "The main menu"},
    {title: "Content", html: "The main content!"}
    ]
  });
  win.show();
});

In the code, we only added the . In this case, we're a with the name of the , but we can also set an and some for the . In fact, every is a class that .

The shows how the fit the of the :

extjs layout fit LearningExtJS(FourthEdition) 第1张

As you can see,even we two to theextjs layout fit, it only shows one. If we the main ,we see that the Menu panel is to fit the new size of the .

The Card

The Card can childextjs layout fit LearningExtJS(FourthEdition),so if we need to a or only one at a timeextjs layout fit, we use this . This the fit class, which means that only one can be at any given time and will fill all the space in the .

We can also set the by its index using the index from the items array. And we can move the by the next or prev . Let's check out the code for the Card :

Ext.onReady(function(){
  var win = Ext.create("Ext.window.Window",{
    title: "My first window",
    width: 300,
    height: 200,
    maximizable: true,
 layout: "card",//Step 1
    defaults:{ xtype: "panel", height: 60, border: false },
    items: [{
      title: "Menu",
      html: "The main menu"
    },{
      title: "Content",
      html: "The main content!"
    }]
  });
  win.show();
  setTimeout(function(){
 win.getLayout().setActiveItem(1); //Step 2
  },3000);
});

The code a with two . We set the of the to card in step one.

In step two, we get the by the after 3 and the item using the (1) to show the panel. We can also use the prev and next from the to show the next and card.

The

to the Card , this us to show one at a time in an style. We will see the of the inner and we're going to be able to and the by on their title bars. Let's check the code for the :

var win = Ext.create("Ext.window.Window",{
  title: "My first window",
  width: 300,
  height: 200,
  maximizable: true,
 layout: "accordion",
  defaults: { xtype: "panel" },
  items:[
    {title: "Menu", html: "The main menu" },
    {title: "Content", html: "The main content!" },
    {title: "3rd Panel", html: "Content here...!" }
  ]
});

the code, we have only / the and added a new panel to the items array. We'll see like the :

extjs layout fit LearningExtJS(FourthEdition) 第2张

When using the , we'll see only one panel at a time. The panel will take the to be . It doesn't if we the .

Note

In the ,it is to point out that we only need to use the Ext.panel.Panel class or of the Ext.panel.Panel class.

The

This the of (child ) to the 's . If the is, then the child will be to the rules to these child .

By ,will based on the size of the . But if the is using theextjs layout fit LearningExtJS(FourthEdition), it will an - of . If the is , the will use it as a for the of the based on it the .

Let's make some to the and set the code like this:

 Ext.onReady(function(){
  var win = Ext.create("Ext.window.Window",{
    title: "My first window",
    width: 300,
    height: 300,
    maximizable : true,
    layout: "anchor",
    defaults: {xtype: "panel", height: 60, border: false},
    items: [
    {
      title: "Menu",  html: "panel at 100% - 10 px", anchor:'-10'
    },{
      title: "Content", html: "panel at 70% of anchor",  anchor:'70%'
    },{
    title: "3rd Panel", html: "panel at 50% width and 40% height of anchor", anchor:'50% 40%', bodyStyle:'background-color:#fc3;'
    }
    ]
  });
  win.show();
});

The will look like the :

extjs layout fit LearningExtJS(FourthEdition) 第3张

When we use the with only one value, will be used on the width of the ,for, :'70%' will cover 70% of the 's width. Using :'-10' will cover 100% minus 10 of the 's width. , when using two , the will be to the width and as in the last panel from the code: :'50% 40%'.

加入微信交流群:************ ,请猛戳这里→点击入群

扫描二维码推送至手机访问。

版权声明:本文由前沿科技娱乐汇发布,如需转载请注明出处。

本文链接:https://www.kejiyl.com/post/6787.html

分享给朋友:

“extjs layout fit LearningExtJS(FourthEdition)” 的相关文章

涨姿势!轻松掌握 [知识主题] 的实用方法

涨姿势!轻松掌握 [知识主题] 的实用方法

在知识的海洋中,我们常常渴望能够快速而有效地掌握各种知识主题,提升自己的素养和能力。今天,我们就来探讨一下如何轻松掌握 [知识主题] 的实用方法,让你在学习的道路上事半功倍。建立明确的学习目标是掌握知识的关键。你需要清楚地知道自己想要学习什么,达到什么样的水平。例如,如果你想学习英语,你可以确定具体...

AI 音乐在现场演出中的创新呈现方式

AI 音乐在现场演出中的创新呈现方式

在当今的音乐领域,AI 音乐正以其独特的魅力和创新的呈现方式,逐渐在现场演出中占据重要的地位。AI 音乐不再仅仅是虚拟的声音创作,而是通过与现场演出的紧密结合,为观众带来了前所未有的体验。AI 音乐在现场演出中的第一个创新呈现方式是与传统乐器的融合。传统乐器一直是音乐现场的核心,它们的音色和表现力赋...

AI 音乐在广告营销中的独特价值与运用策略

AI 音乐在广告营销中的独特价值与运用策略

在当今数字化的时代,广告营销领域正不断迎来新的变革与创新。其中,AI 音乐以其独特的价值和强大的运用策略,正在逐渐成为广告营销中的一颗璀璨明星。AI 音乐的独特价值首先体现在其高度的个性化定制能力上。传统音乐往往是由作曲家或音乐团队创作,难以满足每一个广告项目的特定需求。而 AI 音乐可以根据广告的...

游戏设计中 AI 如何实现环境智能响应

游戏设计中 AI 如何实现环境智能响应

在游戏设计的领域中,AI(人工智能)的应用越来越广泛,而其中环境智能响应是一个至关重要的方面。它能够让游戏中的虚拟环境变得更加生动、富有挑战性和沉浸感,给玩家带来全新的游戏体验。环境智能响应的核心在于让 AI 系统能够感知游戏中的环境变化,并做出相应的反应。这就要求 AI 具备强大的感知能力,能够准...

AI 技术在游戏设计中实现物理模拟的突破

AI 技术在游戏设计中实现物理模拟的突破

在当今的游戏设计领域,AI 技术正逐渐成为推动游戏发展的重要力量。其中,物理模拟的突破尤为显著,它为游戏带来了更加真实、沉浸式的体验,让玩家仿佛置身于一个充满活力和真实感的虚拟世界中。传统的游戏物理模拟往往依赖于预先设定的规则和算法,虽然能够实现一些基本的物理效果,但在真实感和复杂性方面存在一定的局...

AI 创作小说中的文化融合现象研究

AI 创作小说中的文化融合现象研究

在当今全球化的时代背景下,文化融合成为了一个不可忽视的现象,而小说作为一种重要的文学形式,也在不断地展现着文化融合的魅力。AI 创作小说作为一种新兴的文学创作方式,更是为文化融合提供了新的平台和机遇。AI 创作小说中的文化融合现象首先体现在对不同文化元素的融合与运用上。AI 可以通过学习和分析大量的...