jQuery UI Widgets Forums DataTable getCellValue returns empty string for a cell having a button inside

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 9 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • SumitRoy
    Participant

    Dear JQX,
    I have setup a jqx table like this,

    $('#uda-setup-manage-table').jqxDataTable({
                altRows: true,
                sortable: true,
                width: '100%',
                selectionMode: 'singleRow',
                editable: false,
                columns: [
                    {text: 'Setup Name', dataField: 'Setup Name', width: '17%'},
                    {text: 'Usage Data Files', dataField: 'Usage Data Files', width: '17%'},
                    {text: 'Number of Points', dataField: 'Number of Points', width: '17%'},
                    {text: 'Parameters', dataField: 'Parameters', width: '17%'},
                    {text: 'Date', dataField: 'Date', width: '17%'},
                    {text: 'Associated', cellsAlign: 'center', align: "center", width: '5%', columnType: 'none', sortable: false, dataField: "Associated",
                        cellsRenderer: function (row, column, value) {
                            // render custom column.
                            return '<button type="button" class="btn btn-success" aria-label="Left Align">\n\
                                                <span class="glyphicon glyphicon-thumbs-up" aria-hidden="true"></span>\n\
                                            </button>';
                        }
                    },
                    {text: 'Edit', cellsAlign: 'center', align: "center", width: '5%', columnType: 'none', sortable: false, dataField: "Edit",
                        cellsRenderer: function (row, column, value) {
                            // render custom column.
                            return '<button type="button" class="btn btn-success" aria-label="Left Align">\n\
                                                <span class="glyphicon glyphicon-edit" aria-hidden="true"></span>\n\
                                            </button>';
                        }
                    },
                    {text: 'Delete', cellsAlign: 'center', align: "center", width: '5%', columnType: 'none', sortable: false, dataField: "Delete",
                        cellsRenderer: function (row, column, value) {
                            // render custom column.
                            return '<button type="button" class="btn btn-danger" aria-label="Left Align">\n\
                                                <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>\n\
                                            </button>';
                        }
                    }, {
                        text: "Row Status", dataField: "Row Status", hidden: true
                    }
                ]
            });

    now when I run this $('#uda-setup-manage-table').jqxDataTable('getCellValue', 0, 'Associated'); I am getting empty string,
    can you help me to get the button please.

    thanks
    Sumit


    Peter Stoev
    Keymaster

    Hi SumitRoy,

    “getCellValue” returns the data bound cell value. In your case, you do not have such. You have a button which you cannot get. If you want to render buttons into jqxDataTable, please follow this approach: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdatatable/javascript-datatable-command-column.htm?arctic

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    SumitRoy
    Participant

    Hi Peter Steov,
    I saw the link and it is using JSON data,
    but my requirements is say, if I have HTML Based table having buttons in some cell, and I want to wrap the entire table using jqxDataTable as
    $('#uda-setup-manage-table').jqxDataTable({//some code});
    where the uda-setup-manage-table is a HTML Table’s ID

    now after wrapping/transforming it into jqxDataTable how can get the buttons ?
    is there any such way ?


    Peter Stoev
    Keymaster

    Hi SumitRoy,

    The only way to get Buttons is the shown in our demo. You can’t load HTML Table tag which has anything else than Text inside.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.