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

extjs layout fit LearningExtJS(FourthEdition)

admin9小时前AI娱乐2

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://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 驱动的游戏 NPC:如何与玩家实现深度互动

AI 驱动的游戏 NPC:如何与玩家实现深度互动

在当今的游戏世界中,AI 技术的应用使得游戏 NPC(非玩家角色)变得越来越智能和生动。这些 AI 驱动的 NPC 不仅能够提供任务和引导玩家,还能够与玩家实现深度互动,为玩家带来更加丰富和沉浸式的游戏体验。那么,AI 驱动的游戏 NPC 究竟是如何与玩家实现深度互动的呢?AI 驱动的游戏 NPC...

AI 创作小说的类型偏好与受众分析

AI 创作小说的类型偏好与受众分析

在当今数字化的时代,AI 创作小说正逐渐成为文学领域的一股新势力。随着人工智能技术的不断发展,AI 能够生成各种类型的小说,满足不同受众的需求。本文将探讨 AI 创作小说的类型偏好以及其对应的受众群体。一、浪漫爱情类浪漫爱情类小说一直是受众广泛的类型之一,而 AI 在这方面也有着出色的表现。AI 可...