Bug on the first loading of my page

12 posts, 1 answers
  1. Bruno
    Bruno avatar
    17 posts
    Member since:
    Nov 2019

    Posted 23 Jan Link to this post

    Hello,

     

    I have a problem, the first loading of my page displays this page "error" and when I refresh everything is perfect

    Do you have any ideas ? 

     

    Thanks you !

  2. Answer
    Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1115 posts

    Posted 27 Jan Link to this post

    Hi Bruno,

    In order to be able to review the case in question, I would need to replicate the issue locally. Therefore, I would like to ask you to prepare and send me a small isolated runnable sample reproducing the problem. Please, remove any external dependencies and database calls from that project and use sample data created in the app to populate the Grid.

    As per the error in question, may I ask you to share with us what type of error is reported? That would help me to understand better the issue in question.

    Looking forward to hearing from you.

    Regards,
    Veselin Tsvetanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Bruno
    Bruno avatar
    17 posts
    Member since:
    Nov 2019

    Posted 27 Jan Link to this post

    Hello,

     

    Thanks you for your help

     

    <div id="grid"></div>
        <script>
            $(function() {
                $("#grid").kendoGrid({
                    toolbar: ["excel", "pdf", "search"],
                    pdf: {
                        allPages: true,
                        avoidLinks: true,
                        paperSize: "A4",
                        margin: { top: "2cm", left: "1cm", right: "1cm", bottom: "1cm" },
                        landscape: true,
                        repeatHeaders: true,
                        template: $("#page-template").html(),
                        scale: 0.8
                    },
                    excel: {
                        fileName: "Kendo UI Grid Export.xlsx",
                        proxyURL: "#",
                        filterable: true
                    },
                    dataSource: {
                        transport: {
                            read: "https://www.mysite.ga/datakendo/"
                        },
                        pageSize: 100,
                        schema: {
                            data: "data",
    total: function(data){ return data.data.length; }
                        },
                    },

    height: 720,
                    filterable: {
                        mode: "row",
    messages: {
                            info: "Filter by: "
    }
                    },
                    pageable: {
                        pageSizes: [ 25, 50, 100, 500, 1000 ]
                    },
                    reorderable: true,
                    selectable: "multiple",
                    columnMenu: true,
                    resizable: true,
    columns : [
    <?php 

    $select = $_SESSION["column_name"];

    $column = explode(", ", $select);

    //echo count($column);

    for ($i = 0; $i < count($column); $i++) {

    if ($column[$i] == "Logo") {
    echo '{ field: "'.$column[$i].'", width: 100, template: \'<img src="#= Logo #"/>\'},';
    } else {
    echo '{ field: "'.$column[$i].'", width: 90,},';
    }
    }

    ?>
                       
    ]
                    
                });

            });
        </script>

  4. Bruno
    Bruno avatar
    17 posts
    Member since:
    Nov 2019

    Posted 28 Jan in reply to Veselin Tsvetanov Link to this post

    This is in relation to my request to dynamically display the columns. At the first loading nothing is displayed in the source code

     

    In  black, it's comments

  5. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1115 posts

    Posted 29 Jan Link to this post

    Hello Bruno,

    Here you will find a small Dojo sample based on the snippet sent:

    https://dojo.telerik.com/oJiJEFoW

    You will notice that it properly renders Grid data initially. It, however, does not implement the PHP columns logic which was not fully present in the snippet in question. May I ask you to also share that entire logic (the content of the $select variable), so that I can replicate the scenario locally?

    Regards,
    Veselin Tsvetanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  6. Bruno
    Bruno avatar
    17 posts
    Member since:
    Nov 2019

    Posted 29 Jan in reply to Veselin Tsvetanov Link to this post

    Hello,

     

    Thank you for your help, my variable $ select being on the page where we read the data, I just placed it on this one and it works.

    Another small question, I set up a filter with checkboxes and by default it is an equal filter and to make contains what should be changed? please

     

    Thank you for everything !

  7. Bruno
    Bruno avatar
    17 posts
    Member since:
    Nov 2019

    Posted 29 Jan in reply to Veselin Tsvetanov Link to this post

    https://dojo.telerik.com/oJiJEFoW/2

     

    I make an example here

  8. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1115 posts

    Posted 31 Jan Link to this post

    Hi Bruno,

    As far as I can understand, you would like to make the multi checkbox filter configured for the second column in the Grid to filter using contains operator instead of equals. If that is the case, I am afraid the checkbox filter could not be configured to alter its default operator. If you need the contains filter, that should be used with the column menu (just like you did on the first column). If you need to filter our the other possible options from the drop-down and leave only the contains, you could configure the filterable.operators for that specific column:

    columns : [{
      field: "ContactTitle",
      title: "Contact Title",
      filterable:{
        operators:{
          string:{
            contains: "Contains"
          }
        }
      }
    },

    Here you will find a slightly modified Dojo sample implementing the above suggestion for the ContactTitle column:

    https://docs.telerik.com/kendo-ui/api/javascript/ui/grid/configuration/columns.filterable.operators

    Regards,
    Veselin Tsvetanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  9. Bruno
    Bruno avatar
    17 posts
    Member since:
    Nov 2019

    Posted 31 Jan in reply to Veselin Tsvetanov Link to this post

    By checking 25, I get the filter contains because I have for example: "25, 26, 27, 28"

    With this code

    filter: function(e){
    if(e.field == "Classes"){
    e.filter.filters.forEach(function(f){
    f.operator = "contains";
      })
    }
      },
      filterMenuOpen: function(e){
    if(e.sender.dataSource.filter()){
      e.sender.dataSource.filter().filters.forEach(function(f){
    if(f.field == "Classes"){
      var checkbox = e.container.find("input[value='"+f.value+"']");
      if(!checkbox[0].checked){
    e.container.find("input[value='"+f.value+"']").click()  
      }          
    }
      })
       }
      },

     

    The problem is that when I want to clear the filter, nothing happens ??? the filter it's ok !

  10. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1115 posts

    Posted 04 Feb Link to this post

    Hello Bruno,

    First of all, I beg your pardon for missing the modified Dojo from my previous reply. Here is the sample I was referring to:

    https://dojo.telerik.com/oJiJEFoW/7

    As per the issue faced, the above also includes the snippets sent along with your last reply. May I ask you to modify that Dojo, so it replicates the problem observed at your end and send it back to me? This way I will be able to troubleshoot the problem locally and to provide you with the most appropriate assistance on that.

    Regards,
    Veselin Tsvetanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  11. Bruno
    Bruno avatar
    17 posts
    Member since:
    Nov 2019

    Posted 04 Feb in reply to Veselin Tsvetanov Link to this post

    Hi !

     

    No problem, thanks you for your help.

     

    https://dojo.telerik.com/oJiJEFoW/8

     

    In this dojo, with the country, when I make a filter, I can't deactivate it. I have a function which allows to contain in the case where for example there I checked "UK" I will have a country which will be called "UK North" that it is checked too

     

    Second problem, for example when I see the countries available in the filter like France, this country is repeated a certain number, is it possible to have the value only once for all and not repeated 10 times for example?

     

    Thanks you Veselin

  12. Veselin Tsvetanov
    Admin
    Veselin Tsvetanov avatar
    1115 posts

    Posted 05 Feb Link to this post

    Hi Bruno,

    As per the removing filter functionality, you will need an additional check in the filter handler:

    filter: function(e){
      if(e.field == "Country"){
        if(e.filter) {
          e.filter.filters.forEach(function(f){
            f.operator = "contains";
          })
        }
      }
    },

    Concerning the second question, removing the DataSource from the filter definition should resolve the issue faced. Here is the final column definition I would suggest you:

    field: "Country",
    title: "Country",
    filterable: { multi: true, search: true }

    Here is a modified version of the Dojo: https://dojo.telerik.com/oJiJEFoW/13

    Regards,
    Veselin Tsvetanov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top