jQWidgets Forums

jQuery UI Widgets Forums Grid cellsrenderer for checkbox

Tagged: 

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • cellsrenderer for checkbox #120589

    arsue787
    Participant

    Is it possible to do cellsrenderer for checkbox.

    $("#grid1").jqxGrid(
                        {
                            width: "99%",
                            source: dataAdapter,
                            editable: true,
                            width: "100%",
                            height: "250px",
                            sortable: true,
                            selectionmode: "singlerow",
                            editmode: "selectedrow",
                            columnsresize: true,
                            columns: [
    
                                { text: '@ml.getc("Price Level")', datafield: 'DESC', width: "30%" },
                                { text: '@ml.getc("Setting")', datafield: 'SETTING', minwidth: 60, width: "20%" },
                                { text: '@ml.getc("Type")', datafield: 'TYPE', width: "20%", hidden:true},
                                
                                {
                                    text: '@ml.getc("Percent")', 
                                    datafield: 'TYPE1',
                                    columngroup: 'LevelType', 
                                    columntype: 'checkbox', 
                                    cellsrenderer: function (row, column, cellvalue) {
    
                                        var typeValue = cellvalue;
                                        var typeRow = row;
                                         
                                        var cellValue = $("#grid1").jqxGrid('getCell', typeRow, "TYPE");
    
                                        if(cellValue.value == "1")
                                        {
                                            return true;
                                        }
                                        else return false;
                                    },
                                    editable: true, width: "15%" 
                                    
                                },
                                {
                                    text: '@ml.getc("Best Price")', cellsalign: 'right', datafield: 'PR_PROD_PRICE',
                                    minwidth: 80, width: "20%"
                                },
                                { text: '@ml.getc("ROWSTATE")', datafield: 'ROWSTATE', hidden: true }
                            ],
                            columngroups: [
                               { text: 'Type', align: 'center', name: 'LevelType' }
                            ]
                        }); 

    based on other column value, it will reflect the checkbox (checked or unchecked), is it possible to do so?

    Thank you.

    cellsrenderer for checkbox #120600

    Martin
    Participant

    Hello arsue787,

    Yes, it is possible. The cellsrenderer callback returns an html string which is rendered in the cell.
    Please, check this Example. The “Available” column depends on the “Quantity” value.

    Best Regards,
    Martin Yotov

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

    cellsrenderer for checkbox #120612

    arsue787
    Participant

    Hi,

    Thank you, i will try.

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

You must be logged in to reply to this topic.