This is a migrated thread and some comments may be shown as answers.

Bug on the first loading of my page

11 Answers 63 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bruno
Top achievements
Rank 1
Bruno asked on 23 Jan 2020, 10:02 AM

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 !

11 Answers, 1 is accepted

Sort by
0
Accepted
Veselin Tsvetanov
Telerik team
answered on 27 Jan 2020, 07:27 AM

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.
0
Bruno
Top achievements
Rank 1
answered on 27 Jan 2020, 12:52 PM

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>

0
Bruno
Top achievements
Rank 1
answered on 28 Jan 2020, 09:04 AM

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

0
Veselin Tsvetanov
Telerik team
answered on 29 Jan 2020, 07:48 AM

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.
0
Bruno
Top achievements
Rank 1
answered on 29 Jan 2020, 08:21 AM

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 !

0
Bruno
Top achievements
Rank 1
answered on 29 Jan 2020, 08:32 AM

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

 

I make an example here

0
Veselin Tsvetanov
Telerik team
answered on 31 Jan 2020, 07:24 AM

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.
0
Bruno
Top achievements
Rank 1
answered on 31 Jan 2020, 03:17 PM

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 !

0
Veselin Tsvetanov
Telerik team
answered on 04 Feb 2020, 10:02 AM

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.
0
Bruno
Top achievements
Rank 1
answered on 04 Feb 2020, 10:41 AM

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

0
Veselin Tsvetanov
Telerik team
answered on 05 Feb 2020, 03:31 PM

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.
Tags
General Discussions
Asked by
Bruno
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Bruno
Top achievements
Rank 1
Share this question
or