jQuery UI Widgets Forums Grid change expand/collapse toggle button image

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

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • change expand/collapse toggle button image #62984

    dc
    Participant

    Is there a way to change the detail expand/collapse toggle button image?
    I experimented with changing the image file but that changed all kinds of other buttons as well.
    I only want to change this set of buttons.

    Thanks

    change expand/collapse toggle button image #62994

    Dimitar
    Participant

    Hello dc,

    Here is the answer to your question: http://www.jqwidgets.com/community/topic/how-to-change-the-icon-in-the-nested-jqxgrids/#post-26739.

    Best Regards,
    Dimitar

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

    change expand/collapse toggle button image #63002

    dc
    Participant

    Dimitar, I changed the .jqx-grid-group-collapse and .jqx-grid-group-expand like the post.
    It didn’t change it and upon further examination, it was preceeded by the .jqx-icon-arrow-right and .jqx-icon-arrow-down respectively.
    When I override in in chrome dev tool, that changes the row expand icon image. However, I have dropdowns in the detail grid and they also got changed. Any insight would be appreciated.

    Thanks

    change expand/collapse toggle button image #63059

    Dimitar
    Participant

    Hi dc,

    Here is an example. The icons of the parent grid are changed but those of the nested grids are the default ones:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
        <style type="text/css">
            #jqxgrid .jqx-grid-group-expand
            {
                background-image: url("http://horizoninnga.com/modules/board/skins/xe_official_planner123/images/icon/16x16/minus_round.png");
            }
            #jqxgrid .jqx-grid-group-collapse
            {
                background-image: url("https://www.competitionpolicyinternational.com/themes/cpi/images/plus-circle.png");
            }
            .innerGrid .jqx-grid-group-expand
            {
                background-image: url("../../jqwidgets/styles/images/icon-down.png") !important;
            }
            
            .innerGrid .jqx-grid-group-collapse
            {
                background-image: url("../../jqwidgets/styles/images/icon-right.png") !important;
            }
        </style>
        <script type="text/javascript" src="../../scripts/jquery-1.11.1.min.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
        <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
        <script type="text/javascript" src="../../scripts/demos.js"></script>
        <script type="text/javascript" src="generatedata.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                // prepare the data
                var data = new Array();
                var firstNames =
                [
    	            "Andrew", "Nancy", "Shelley", "Regina", "Yoshi", "Antoni", "Mayumi", "Ian", "Peter", "Lars", "Petra", "Martin", "Sven", "Elio", "Beate", "Cheryl", "Michael", "Guylene"
                ];
                var lastNames =
                [
    	            "Fuller", "Davolio", "Burke", "Murphy", "Nagase", "Saavedra", "Ohno", "Devling", "Wilson", "Peterson", "Winkler", "Bein", "Petersen", "Rossi", "Vileid", "Saylor", "Bjorn", "Nodier"
                ];
                var productNames =
                [
    	            "Black Tea", "Green Tea", "Caffe Espresso", "Doubleshot Espresso", "Caffe Latte", "White Chocolate Mocha", "Cramel Latte", "Caffe Americano", "Cappuccino", "Espresso Truffle", "Espresso con Panna", "Peppermint Mocha Twist"
                ];
                var priceValues =
                [
    	            "2.25", "1.5", "3.0", "3.3", "4.5", "3.6", "3.8", "2.5", "5.0", "1.75", "3.25", "4.0"
                ];
                for (var i = 0; i < 10; i++) {
                    var row = {};
                    var productindex = Math.floor(Math.random() * productNames.length);
                    var price = parseFloat(priceValues[productindex]);
                    var quantity = 1 + Math.round(Math.random() * 10);
                    row["firstname"] = firstNames[Math.floor(Math.random() * firstNames.length)];
                    row["lastname"] = lastNames[Math.floor(Math.random() * lastNames.length)];
                    row["productname"] = productNames[productindex];
                    row["price"] = price;
                    row["quantity"] = quantity;
                    row["total"] = price * quantity;
                    data[i] = row;
                }
                var source =
                {
                    localdata: data,
                    datatype: "array"
                };
    
                var dataAdapter = new $.jqx.dataAdapter(source);
    
                var initlevel2 = function (index) {
                    var grid = $($.find('#grid' + index));
                    if (grid != null) {
                        grid.addClass("innerGrid");
                        var dataAdapter = new $.jqx.dataAdapter(source);
                        grid.jqxGrid({ rowdetails: true, initrowdetails: initlevel3, source: dataAdapter, theme: theme, width: 600, height: 200,
                            rowdetailstemplate: { rowdetails: "<div id='subgrid' style='margin: 10px;'></div>", rowdetailsheight: 220, rowdetailshidden: true },
                            columns: [
    			                { text: 'First Name', dataField: 'firstname', width: 100 },
    			                { text: 'Last Name', dataField: 'lastname', width: 100 },
    			                { text: 'Product', dataField: 'productname', width: 180 },
    			                { text: 'Quantity', dataField: 'quantity', cellsalign: 'right' }
    			            ]
                        });
                    }
                }
    
                var initlevel3 = function (index) {
                    var grid = $($.find('#subgrid' + index));
                    var dataAdapter = new $.jqx.dataAdapter(source);
                    if (grid != null) {
                        grid.jqxGrid({ source: dataAdapter, theme: theme, width: 530, height: 200,
                            columns: [
                			    { text: 'First Name', dataField: 'firstname', width: 100 },
                			    { text: 'Last Name', dataField: 'lastname', width: 100 },
                			    { text: 'Product', dataField: 'productname', width: 180 },
                			    { text: 'Quantity', dataField: 'quantity', cellsalign: 'right' }
                			]
                        });
                    }
                }
    
                $("#jqxgrid").jqxGrid(
                {
                    width: 670,
                    height: 365,
                    source: dataAdapter,
                    theme: theme,
                    rowdetails: true,
                    initrowdetails: initlevel2,
                    rowdetailstemplate: { rowdetails: "<div id='grid' style='margin: 10px;'></div>", rowdetailsheight: 220, rowdetailshidden: true },
                    columns: [
    		            { text: 'First Name', dataField: 'firstname', width: 100 },
    		            { text: 'Last Name', dataField: 'lastname', width: 100 },
    		            { text: 'Product', dataField: 'productname', width: 180 },
    		            { text: 'Quantity', dataField: 'quantity', width: 80, cellsalign: 'right' },
    		            { text: 'Unit Price', dataField: 'price', width: 90, cellsalign: 'right', cellsformat: 'c2' },
    		            { text: 'Total', dataField: 'total', cellsalign: 'right', minwidth: 100, cellsformat: 'c2' }
    	            ]
                });
            });
        </script>
    </head>
    <body class='default'>
        <div id="jqxgrid">
        </div>
    </body>
    </html>

    Best Regards,
    Dimitar

    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.