Home Analyst Portal

SQL Widget default column width

Jan_SchulzJan_Schulz Customer Adept IT Monkey ✭✭

Hi,

is it possible to give the coloumns of the sql widget a default value for each one?


regards,

Jan

Best Answer

  • James_JohnsonJames_Johnson Customer Advanced IT Monkey ✭✭✭
    Answer ✓

    I've done custom formatting of a table using JS that runs when the page is loaded.

    Here is the script I use, you use the Kendo api to edit most of the properties of a table, there may be a better way than doing the timeout but this works for the most part.

    $(document).ready(function (){
        var url = window.location.href;
        if(url.indexOf("/Page/9e5780c8-5e0a-4520-893f-b13f522d6241#/") > -1){ // Verify we are on the report page
                setTimeout(function() { // Grid is not ready when the document is ready, so this delay is necessary
                        var grid = $('[data-role=grid]') // Get the grid object
                        if(grid.length > 0){ // If the grid object is not found for whatever reason, we don't want the page load to fail
                            console.log("found grid")
                            if(grid.data('kendoGrid').dataSource._filter == null){
                            // If we are in here, that means the user never applied any kendo filtering elements. The code to change the pagination would then go here.
                                grid.data('kendoGrid').dataSource.group({field: "Queue"});
                                grid.data('kendoGrid').dataSource.sort({field: "Queue", dir: "asc"});
                                
                                grid.find(".k-grid-pager").insertBefore($(".k-grouping-header")); // Moves the pagination numbers up
                                grid.data('kendoGrid').dataSource.pageSize(100); // Sets the default page size to 200
                                console.log("settings applied")
                            }
                        }
                },2000);
        }
    });
    

Answers

  • James_JohnsonJames_Johnson Customer Advanced IT Monkey ✭✭✭
    Answer ✓

    I've done custom formatting of a table using JS that runs when the page is loaded.

    Here is the script I use, you use the Kendo api to edit most of the properties of a table, there may be a better way than doing the timeout but this works for the most part.

    $(document).ready(function (){
        var url = window.location.href;
        if(url.indexOf("/Page/9e5780c8-5e0a-4520-893f-b13f522d6241#/") > -1){ // Verify we are on the report page
                setTimeout(function() { // Grid is not ready when the document is ready, so this delay is necessary
                        var grid = $('[data-role=grid]') // Get the grid object
                        if(grid.length > 0){ // If the grid object is not found for whatever reason, we don't want the page load to fail
                            console.log("found grid")
                            if(grid.data('kendoGrid').dataSource._filter == null){
                            // If we are in here, that means the user never applied any kendo filtering elements. The code to change the pagination would then go here.
                                grid.data('kendoGrid').dataSource.group({field: "Queue"});
                                grid.data('kendoGrid').dataSource.sort({field: "Queue", dir: "asc"});
                                
                                grid.find(".k-grid-pager").insertBefore($(".k-grouping-header")); // Moves the pagination numbers up
                                grid.data('kendoGrid').dataSource.pageSize(100); // Sets the default page size to 200
                                console.log("settings applied")
                            }
                        }
                },2000);
        }
    });
    
  • Jan_SchulzJan_Schulz Customer Adept IT Monkey ✭✭

    @James_Johnson thank you.

Sign In or Register to comment.