Extjs3.2 automatic adaptation of gridpanel height and width

Source: Internet
Author: User
The effect is as follows:

Adaptive settings must be set on both the horizontal and vertical heights.
In smartgwt (smartclient), the height and width can be both 100%. The JS class library of smartclient automatically synchronizes the size of the other container and the parent container.
However, the autowidth and autoheight of the gridpanel of extjs do not play this role, and the 100% setting is not supported.

Later, we found that we needed to set layout: 'fit 'in the parent container and then added viewconfig {forcefit: True to gridpanel, // Let the grid columns automatically fill the entire width of the grid, you do not need to set the width of a column.

The Code is as follows: parent container

Jobdefine :{
Title: 'Task define ',
Iconcls: 'icon _ job ',
Closable: True,
Layout: 'fit ',
Tbar: New Ext. toolbar ({
Items :[{
Text: 'add task ',
Iconcls: 'btnadd _ icon'
},'-',{
Text: 'delete task ',
Iconcls: 'btndel _ icon'
}, '-', New Ext. UX. Form. searchfield ({
Store: jobinfostore,
Emptytext: 'Enter the task name search'
})]
}),
Items: [createjobinfogrid ('jobfailed')]
}

 

Grid panel configuration

VaR grid = new Ext. Grid. gridpanel ({
ID: ID,
CM: cm,
SM: Sm,
Store: jobinfostore,
Border: false,
Loadmask: True,
Viewconfig :{
Forcefit: True, // make the grid column automatically fill the entire width of the grid, without setting the width of a column.
Emptytext: 'The system has no task'
},
Bbar: New Ext. pagingtoolbar ({
Pagesize: 25,
Store: jobinfostore,
Displayinfo: True,
Displaymsg: 'currently {0}-{1} total {2 }',
Emptymsg: "No record is displayed"
})
})

Extjs started to use for a month. It is a powerful class library, but the solution to many small details is not so intuitive!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.