How to get a value from one cell in another cell Tags: DevExtreme (HTML JS), Data Grid

dxDataGrid is a widget that is based on HTML 5, JavaScript and CSS 3. It cannot be used on the server side. We do not recommend using server-side components in our client-side widgets. It is impossible to get any value from dxDataGrid on the server side. Use our widgets or standard input elements in dxDataGrid templates. The http://jsfiddle.net/89k6ss9m/ example demonstrates how to accomplish a similar task. You can use it as a starting point.
See also:
dxDataGrid.columns.cellTemplate

$(“#container”).dxDataGrid({
    dataSource: {
        store: {
            type: ‘odata’,
        },
        select: [‘OrderID’, ‘CustomerID’, ‘EmployeeID’]
    },
    loadPanel: false,
    scrolling: {
        mode: ‘virtual’,
        preloadEnabled: true
    },
    paging: {pageSize: 30},
    columns: [‘OrderID’, ‘CustomerID’, {
        dataField: ‘EmployeeID’,
        cellTemplate: function(cellElement, cellInfo) {
            $(‘<div>’)
            .appendTo(cellElement)
            .dxTextBox({
                value: cellInfo.value
            });
            $(‘<div>’)
            .appendTo(cellElement)
            .dxButton({
                text: ‘Click me’,
                onClick: function(e) {
                    alert(cellInfo.data.CustomerID);
                }
            });
        }
    }]
});

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: