Telerik Forums
Kendo UI for jQuery Forum
0 answers
120 views

i have  enabled the Content Security Policy (CSP) in my mvc project i have view where i have mvc grid hierarchy 

https://demos.telerik.com/aspnet-mvc/grid/hierarchy exmple i have used 

 

when i add Deferred to the grid the inner grid wont work 

i get an error

jquery-3.6.3.min.js:2 Uncaught Error: Syntax error, unrecognized expression: #Grid_#=EmployeeID#
    at se.error (jquery-3.6.3.min.js:2:13911)
    at se.tokenize (jquery-3.6.3.min.js:2:21922)
    at se.select (jquery-3.6.3.min.js:2:22749)
    at Function.se (jquery-3.6.3.min.js:2:7196)
    at a.find (jquery-migrate.min.js:2:1675)
    at E.fn.init.find (jquery-3.6.3.min.js:2:25319)
    at E.fn.init (jquery-3.6.3.min.js:2:25808)
    at new a.fn.init (jquery-migrate.min.js:2:1276)
    at E (jquery-3.6.3.min.js:2:1051)
    at HTMLDocument.<anonymous> (Index:505:1618)

 

 

code cshtml 

 

@using PM.Common;
@using PM.Common.Helper;
@using PM.PartnerManagement.Models;
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@(Html.Kendo().Grid<PM.PartnerManagement.Common.Employeeviewmodel>()
            .Name("grid")
            .Columns(columns =>
            {
                columns.Bound(e => e.FirstName).Width(130);
                columns.Bound(e => e.LastName).Width(130);
                columns.Bound(e => e.Country).Width(130);
                columns.Bound(e => e.City).Width(110);
                columns.Bound(e => e.Title);
            })
            .Sortable()
            .Pageable()
            .Scrollable()
            .ClientDetailTemplateId("template")
            .HtmlAttributes(new { style = "height:600px;" })
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(6)
                .Read(read => read.Action("HierarchyBinding_Employees", "Test"))
            )
          .Events(events => events.DataBound("dataBound")).Deferred()
  )
<script id="template" type="text/kendo-tmpl" >
    @(Html.Kendo().Grid<PM.PartnerManagement.Common.orderViewmodel>()
                    .Name("Grid_#=EmployeeID#") // template expression, to be evaluated in the master context
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.OrderID).Width(110);
                        columns.Bound(o => o.ShipCountry).Width(150);
                        columns.Bound(o => o.ShipAddress).ClientTemplate("\\#= ShipAddress \\#"); // escaped template expression, to be evaluated in the child/detail context
                        columns.Bound(o => o.ShipName).Width(300);
                    })
                    .DataSource(dataSource => dataSource
                        .Ajax()
                        .PageSize(10)
                        .Read(read => read.Action("HierarchyBinding_Orders", "Test", new { employeeID = "#=EmployeeID#" }))
                    )
                    .Pageable()
                    .Sortable().Deferred()
                .ToClientTemplate()
    )


</script>

<script nonce="@PM.Common.Constant.Nonce">
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
</script>

<script nonce="@Constant.Nonce">
    @Html.Kendo().DeferredScripts(false);
</script>

CS

using PM.Core.Repositories;
using PM.Portal.Controllers;
using PM.Portal.Filters;
using System.Web.Mvc;
using PM.Core.Repositories.Interface;
using Kendo.Mvc.UI;
using System.IO;
using Newtonsoft.Json;
using System.Collections.Generic;
using Kendo.Mvc.Extensions;

namespace PM.PartnerManagement.Controllers
{
    [Authorize(Order = 1)]
    public class TestController : BaseController
    {
        #region GLOBAL VARIABLES USED IN THIS CONTROLLER

        ICommonRepository _repoCommon = new CommonRepository();
        IWorkOrderRepository _repoWorkOrder = new WorkOrderRepository();

        #endregion
        
        //[WebRoleFilter]
        public ActionResult Index()
        {
            return View();
        }

        public JsonResult HierarchyBinding_Employees([DataSourceRequest] DataSourceRequest request)
        {
            string text = System.IO.File.ReadAllText(@"C:\Neeraj Repo\PartnerManagement\Dev\Bill360_Dev\Bill360_New\PM.PartnerManagement\Json\Employee.json");
             List<PM.PartnerManagement.Common.Employeeviewmodel> GetEmployees = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PM.PartnerManagement.Common.Employeeviewmodel>>(text);          
            return Json(GetEmployees.ToDataSourceResult(request),JsonRequestBehavior.AllowGet);
        }

        public JsonResult HierarchyBinding_Orders(int employeeID, [DataSourceRequest] DataSourceRequest request)
        {
            string text = System.IO.File.ReadAllText(@"C:\Neeraj Repo\PartnerManagement\Dev\Bill360_Dev\Bill360_New\PM.PartnerManagement\Json\order.json");
            List<PM.PartnerManagement.Common.orderViewmodel> Getorders = Newtonsoft.Json.JsonConvert.DeserializeObject<List<PM.PartnerManagement.Common.orderViewmodel>>(text);

            return Json(Getorders.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
        }
    }
}

 

neeraj
Top achievements
Rank 1
 asked on 09 Oct 2023
2 answers
150 views

I have a bunch of Kendo grids within divs. I am letting the user sort those divs on the screen. After sorting, my Kendo grid no longer functions correctly, for example, clicking on a column header no longer sorts. I'm sure it has to do with me removing and replacing the element elsewhere on the screen. How do I rebind the grid after the element has been removed from the DOM and replaced. This is the relevant line of JQuery where the kendo grids are, among other html, contained within sortedRows. 

I do have the grid stored in a variable from before the move because when I created the grid the first time I did: 
let myGrid = $("myGrid").data("kendoGrid");
    let sortedRows = [...rows];
    if (direction !== "original") {
        sortedRows.sort(function (a, b) {
            let rowA = a.getElementsByClassName("responsive-table__cell")[columnIndex];
            rowA = $(rowA).find(".js-sort-value").text().toLowerCase();
            let rowB = b.getElementsByClassName("responsive-table__cell")[columnIndex];
            rowB = $(rowB).find(".js-sort-value").text().toLowerCase();
            if (sortType === "number") {
                rowA = parseFloat(rowA);
                rowB = parseFloat(rowB);
            }
            if (direction === "asc") {
                return rowA > rowB ? 1 : -1;
            } else {
                return rowA > rowB ? -1 : 1;
            }
        });
    }
$(`#myCodeBlock`).find(".responsive-table__body").empty().append(sortedRows);
Neli
Telerik team
 answered on 06 Oct 2023
0 answers
99 views
As of R3 2023 release, the font icons are detached from the themes css files. If you are still using font icons, make sure to include a reference to the font icons in your applications. You can read more information about the change in the following blog post: https://www.telerik.com/blogs/future-icons-telerik-kendo-ui-themes. It contains essential information about the change for all products and migration articles to svg icons.
Telerik Admin
Top achievements
Rank 1
Iron
 asked on 06 Oct 2023
2 answers
121 views
I want to integrate the Kendo UI TreeView component and Grid together such that the data in the Grid changes when interacting with the TreeView tabs.
Neli
Telerik team
 answered on 04 Oct 2023
0 answers
103 views

In Export as Excel limited data is only Shown, If we add more data in the Kendo Table Grid, Additionally,  When we click on Export as Excel, only the same set of data is shown, without any new data being added to the  Excel Sheet.

See here Data is upto 45 in Kendo Table but when we export as Excel then only upto 32 data is loading, no new data is being loaded on Excel Sheet.

Mohit
Top achievements
Rank 1
 asked on 03 Oct 2023
1 answer
103 views

https://demos.telerik.com/kendo-ui/editor/pdf-export

The button works but it's blank.  How would one put a PDF icon or say PDF in text for the button?

Neli
Telerik team
 answered on 03 Oct 2023
9 answers
129 views

I am creating a dynamic line chart (see previous https://www.telerik.com/account/support-center/view-ticket/1623605) I am facing another issue with the line chart - in which entries are appending for some apparent reason at the end. Instead of the horizontal (x) axis being a consecutively ordered, the chart itself restarts the axis for the second series of data.

 

Here is an image of the current issue I am facing.

 

As you can see above, instead of filling these entries in back at the beginning, the entire horizontal axis restarts from 0. 

The only points that work "correctly" are points that exactly match each other in the beginning.

At 4:54:00 both points share that exact "second" in time so the "green" point appears appropriately.

If the point does not "match" exactly, it is added and appended to the very end of the horizontal axis as I showed above.

What is causing this? Why does the horizontal axis restart?

My code is as follows:


 <div id="example">        
      <div class="demo-section wide">
        <div id="chart"></div>
      </div>
      <script>
          var testNum = "Test Data for #" + '@Model.testNum';       

          var datareader = JSON.parse(Model.dynamicDataRetrievedFromCSV);         

          function createChart() {
              $("#chart").kendoChart({
                  renderAs: "canvas",
                  title: {
                      text: testNum
                  },
                  legend: {
                      visible: true
                  },
                  seriesDefaults: {
                      type: "line",
                      /*stack: true,*/             

                      labels: {
                          visible: false,
                          format: "{0}",
                          background: "transparent"
                      }
                  },
                  valueAxis: {
                      labels: {
                          format: "{0}"
                      },
                      line: {
                          visible: false
                      },
                      min: 0,
                      max: 300

                  },
                  categoryAxis: {
                      majorGridLines: {
                          visible: false
                      },
                      min: 0,
                      max: 10
                  },
                  tooltip: {
                      visible: true,
                      template: "#= series.name #: #= value #"
                  },
                   pannable: {
             
                  },
                  zoomable: {
                      mousewheel: {
                          rate: 0.1
                      },
                      selection: {
                         
                      }
                  }
                
              });
          }

        $(document).ready(createChart);
        $(document).bind("kendo:skinChange", createChart);
          $(document).ready(function () {
              let chart = $("#chart").data("kendoChart");
              var dataParsed = datareader;

              let ds = new kendo.data.DataSource({
                  data: dataParsed,
                  group: "label"
              });
              

              chart.setOptions({
                  dataSource: ds,
                  series: [{
                      field: "value",
                      categoryField: "time",
                      visible: false
                  }]
              }); 
          });
     
      </script>
    </div>

 

Thank you for any help, and thanks for the support you guys have provided over the last couple weeks!

 

 

 

 

Eli
Top achievements
Rank 2
Iron
Iron
Iron
 answered on 30 Sep 2023
2 answers
268 views

seems just work perfectly if the tag is FORM, if div, submit will not be fired, would be great to have one of two options:

1 - use div tag (all works well except submit)

2 - give the ability to get a model from the form, like when submitting (e.model), form.model or form.model(), now have to form._model & get to string & back to json to be able to post

P.S some time we cant use form tag to do not have it nested

 

 

David Black
Top achievements
Rank 1
Iron
 answered on 29 Sep 2023
1 answer
114 views

Hi,

I think the filter widget has been omited from the messages file.

I changed the demo code to show that the grid widget getting the messages in the right language (fr-CA) while the filter widget remains in en-US.

Here's the dojo example of the problem.  I alos included a picture.

I took a look at the messages files and only few cultures seems to have implemented the the filter widget messages (ru-RU, zh-CN, zh-HK, zh-TW).

I know I can set my own message thru the filter's configuration messages but ain't that something that should be handled kendo's culture?

Or maybe I'm doing something wrong?

Regards,

Simon

Nikolay
Telerik team
 answered on 29 Sep 2023
1 answer
239 views

Hi Team,

I am using Kendo Scheduler in my project. I want to start my week and month from Monday. Currently they are starting from Sunday.

Will you please suggest me a way to solve this.

Thanks

Neli
Telerik team
 answered on 29 Sep 2023
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
Date/Time Pickers
Spreadsheet
Upload
ListView (Mobile)
ComboBox
TabStrip
MultiSelect
AutoComplete
ListView
Menu
Templates
Gantt
Validation
TreeList
Diagram
NumericTextBox
Splitter
PanelBar
Application
Map
Drag and Drop
ToolTip
Calendar
PivotGrid
ScrollView (Mobile)
Toolbar
TabStrip (Mobile)
Slider
Button (Mobile)
SPA
Filter
Drawing API
Drawer (Mobile)
Globalization
Gauges
Sortable
ModalView
Hierarchical Data Source
Button
FileManager
MaskedTextBox
View
Form
NavBar
Notification
Switch (Mobile)
SplitView
ListBox
DropDownTree
PDFViewer
Sparkline
ActionSheet
TileLayout
PopOver (Mobile)
TreeMap
ButtonGroup
ColorPicker
Pager
Styling
MultiColumnComboBox
Chat
DateRangePicker
Dialog
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
OrgChart
TextBox
Effects
Accessibility
ScrollView
PivotGridV2
BulletChart
Licensing
QRCode
ResponsivePanel
Switch
Wizard
CheckBoxGroup
TextArea
Barcode
Collapsible
Localization
MultiViewCalendar
Touch
Breadcrumb
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
Popover
DockManager
FloatingActionButton
TaskBoard
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?