How to add a picture state or button to Extjs grid_extjs
We often need to add a picture status or button in the extjs grid. Let’s summarize the methods we have used:
1. Status representation:
renderer:function(value){
if(value==0){
return "

}else if(value==1){
return "

}
return value;
}
Add renderer identification status in columns. The effect is as follows:
http://images.cnitblog.com/ blog/489550/201304/19103818-94991d9869a6458e8a568efdea6081b5.png
2. Event handling:
Add onclick event directly to img:

The event is to pass the required data.
Another way is to add a cell click event to the grid:
listeners: {
cellClick: viewDoc
}
function viewDoc(grid, rowIdx, colIdx, e) {
var action = e.getTarget(). value;
}
In this way, you can get the clicked cell and then add event processing.
3. You can use 'actioncolumn' to add image buttons
{header:'certificate',sortable:false,width:80,align:'center',scope:this,
xtype:
'actioncolumn',
items : [{
icon : '${ctx}/img/details.png',
tooltip : 'Display certificate',
handler : function(grid, rowIndex, colIndex) {
var record = grid.getStore().getAt(rowIndex);
//. . .
}
]}
This way you can also add pictures to grid cells.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Win10 notes are very useful when placed on the desktop. When using it, if you want to add a picture to the note, how should you do it? We can directly search for the note on the taskbar, and then directly click the picture icon to perform the operation. , please see the introduction below for details. 1. Click Ctrl+alt+c to open the large input box. 2. Drag the local image to the file transfer area below the input box (supports dragging multiple images at one time). 3. Click "Save" to save the image to this content and automatically store it in the cloud. 4. When viewing, click the network disk icon below the entry and a preview box will appear.

In front-end interviews, we are often asked how to implement dice/mahjong layout using CSS. The following article will introduce to you how to use CSS to create a 3D dice (Flex and Grid layout implement 3D dice). I hope it will be helpful to you!

With the continuous development and popularity of Web applications, more and more companies and individuals are beginning to use PHP and ExtJS to build powerful Web applications. As a popular server-side scripting language, PHP is cross-platform and easy to learn, while ExtJS is a popular front-end framework that can help developers quickly build interactive web application interfaces. This article will introduce how to use PHP and ExtJS to implement powerful web application functions. Establish PHP and MySQL database connections for use

CSS layout framework: Explore the five commonly used layout frameworks Introduction: In web design, layout is a crucial part. The CSS layout framework can help us quickly build web pages with different layout styles. This article will introduce five commonly used CSS layout frameworks and provide specific code examples to help readers better understand and use these frameworks. 1. Bootstrap: Bootstrap is one of the most popular CSS layout frameworks currently. It has rich components and powerful responsive features that can

CSS adaptive layout attribute optimization tips: flex and grid In modern web development, implementing adaptive layout is a very important task. With the popularity of mobile devices and the diversification of screen sizes, it is an essential requirement to ensure that the website can be displayed well on various devices and adapt to different screen sizes. Fortunately, CSS provides some powerful properties and techniques for implementing adaptive layout. This article will focus on two commonly used properties: flex and grid, and provide specific code examples.

Detailed explanation of CSS relative layout properties: position and relative In front-end development, layout is often a problem that developers need to face. In order to better control the position of elements on the page, CSS provides a variety of layout methods. Among them, relative layout is a very common layout method. By using the position and relative attributes, we can flexibly adjust the position and size of elements. The position attribute is used to define the positioning method of the element. Common values

CSS panel layout properties: grid and grid-template-columns In modern web page layout, panel layout is a common design method that can arrange web content in a grid. The grid layout attribute in CSS and the grid-template-columns attribute are the keys to realizing panel layout. 1. Introduction to the grid layout attribute The grid layout attribute is an attribute used to create a grid layout in CSS. By converting HTML

UniApp’s implementation skills for implementing page layout and responsive design Introduction: UniApp is a cross-platform development tool based on the Vue.js framework, which can simultaneously develop applications for multiple platforms such as iOS, Android, and H5. This article will introduce how to use UniApp to implement page layout and responsive design, and provide some practical code examples. 1. Page layout Flex layout Flex layout is a commonly used method in page layout, which can automatically adapt to different screen sizes and devices. In UniApp
