본문 바로가기
IT Develop/ExtJs

Extjs grid cell click event.

by K-popcorn 2023. 4. 19.
반응형

ExtJS는 풍부하고 대화형 웹 응용프로그램을 만드는 데 사용되는 강력하고 인기 있는 JavaScript 프레임워크입니다. 핵심 구성 요소 중 하나는 그리드로, 사용자 정의 가능하고 유연한 방식으로 표 데이터를 표시하는 데 사용됩니다. 이 블로그에서는 ExtJS 그리드 셀 클릭 이벤트를 처리하는 방법에 대해 설명합니다.

ExtJS 그리드 셀 클릭 이벤트는 사용자가 그리드 내의 셀을 클릭할 때 트리거됩니다. 이 이벤트는 셀의 데이터를 업데이트하거나 셀과 관련된 추가 정보를 표시하거나 자세한 내용이 있는 팝업 창을 여는 등 다양한 작업을 수행하는 데 사용할 수 있습니다.

Extjs Grid


다음은 ExtJS 그리드 셀 클릭 이벤트를 처리하는 방법의 예입니다:

 

Ext.create('Ext.grid.Panel', {
    title: 'My Grid',
    store: myStore,
    columns: [
        {header: 'Name', dataIndex: 'name'},
        {header: 'Age', dataIndex: 'age'},
        {header: 'Address', dataIndex: 'address'}
    ],
    listeners: {
        cellclick: function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts) {
            // Handle the cell click event here
            // grid - the grid component
            // td - the cell element that was clicked
            // cellIndex - the index of the cell that was clicked
            // record - the record associated with the row that was clicked
            // tr - the row element that was clicked
            // rowIndex - the index of the row that was clicked
            // e - the raw event object
            // eOpts - additional options passed to the event
        }
    }
});



이 예에서는 저장소와 열이 있는 그리드 패널을 만듭니다. 또한 셀을 클릭할 때마다 트리거되는 셀 클릭 수신기를 그리드 패널에 추가합니다. 수신기 기능은 그리드 구성 요소, 클릭한 셀 요소, 클릭한 행과 관련된 레코드 및 원시 이벤트 개체를 포함한 여러 매개 변수를 사용합니다.

수신기 기능 내에서 원하는 작업을 수행하여 셀 클릭 이벤트를 처리할 수 있습니다. 예를 들어, 선택한 레코드에 대한 자세한 정보가 포함된 팝업 창을 표시하거나 클릭한 셀의 데이터를 업데이트할 수 있습니다.

전반적으로 ExtJS 그리드 셀 클릭 이벤트는 대화형 및 동적 웹 애플리케이션을 생성하는 강력한 도구입니다. 이 이벤트를 처리함으로써 사용자에게 원활하고 직관적인 환경을 제공하여 표 형식의 데이터 작업을 간편하게 수행할 수 있습니다.

 

 

(Eng.Ver)

ExtJS is a powerful and popular JavaScript framework used to create rich and interactive web applications. One of its core components is the grid, which is used to display tabular data in a customizable and flexible manner. In this blog, we will discuss how to handle the ExtJS grid cell click event.

The ExtJS grid cell click event is triggered when a user clicks on a cell within a grid. This event can be used to perform various actions, such as updating the data in the cell, displaying additional information related to the cell, or opening a pop-up window with more details.

Here is an example of how to handle the ExtJS grid cell click event:

 

Ext.create('Ext.grid.Panel', {
    title: 'My Grid',
    store: myStore,
    columns: [
        {header: 'Name', dataIndex: 'name'},
        {header: 'Age', dataIndex: 'age'},
        {header: 'Address', dataIndex: 'address'}
    ],
    listeners: {
        cellclick: function(grid, td, cellIndex, record, tr, rowIndex, e, eOpts) {
            // Handle the cell click event here
            // grid - the grid component
            // td - the cell element that was clicked
            // cellIndex - the index of the cell that was clicked
            // record - the record associated with the row that was clicked
            // tr - the row element that was clicked
            // rowIndex - the index of the row that was clicked
            // e - the raw event object
            // eOpts - additional options passed to the event
        }
    }
});


In this example, we create a grid panel with a store and columns. We also add a cellclick listener to the grid panel, which is triggered whenever a cell is clicked. The listener function takes several parameters, including the grid component, the cell element that was clicked, the record associated with the row that was clicked, and the raw event object.

Within the listener function, you can handle the cell click event by performing any desired actions. For example, you could display a pop-up window with more details about the selected record, or you could update the data in the clicked cell.

Overall, the ExtJS grid cell click event is a powerful tool for creating interactive and dynamic web applications. By handling this event, you can provide users with a seamless and intuitive experience that makes working with tabular data a breeze.

반응형

'IT Develop > ExtJs' 카테고리의 다른 글

Extjs Grid Sample  (0) 2023.04.24
Login screen using ExtJS.  (0) 2023.04.18
chat screen code on Extjs.  (0) 2023.04.18

댓글