Telerik Forums
UI for ASP.NET MVC Forum
0 answers
180 views

I'm formatting a grid using the setOptions method. I'm setting the three following properties:

  • pageSizes
  • pageSize
  • height

I'm doing it by calling the setOptions method from the window.load method, like this:

grid.setOptions({
    groupable: true
    , pageable: {
        pageSizes: selPageSizes,
        pageSize: selDefaultPageSize
    }
    , dataSource: { pageSize: selDefaultPageSize }
    , height: selGridHeight
    height: selGridHeight
    groupable: true
});

When the grid data is loaded from the beginning, everything works fine, but if the grid is loaded after the page is loaded, I'm getting and error in the console, that I believe is related with the kendo code, not my code. Then, the data is never loaded into the grid, and the format is lost. This is the error that I'm getting:

Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at Function.grep (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:128089)
    at vh (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:1624055)
    at init._createHeaderCells (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:1745497)
    at init._thead (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:1749404)
    at init._continueInit (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:1637952)
    at init (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:1637851)
    at init.setOptions (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:1643697)
    at HTMLDivElement.<anonymous> (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:17624)
    at Function.each (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:127618)
    at i.fn.init.each (scripts?v=AVz3fyQ7ZO52UNjzde7myJ8QPQ5jc3JcuS7NoqRhdVw1:1:125575)

 

And this is the pieace of code where the error is happening:

 

 

Alex
Top achievements
Rank 1
 asked on 21 Mar 2022
1 answer
529 views

Hi,

I have kendo mvc grid in my application and I am using toolbar to save the changes in the grid, Toolbar is coming on the top of the kendo grid. I want to add Toolbar at both top and bottom of the grid, please  suggest me to achieve  it.

Yanislav
Telerik team
 answered on 21 Mar 2022
0 answers
183 views

Hi,

 

We are upgrading Telerik UI ASP.NET MVC from 2017.2.504.545 to 2022.1.301.545. We installed the latest DLL from MSI file and manually replaced the scripts and CSS files in the solution as well as referenced the 2022 Kendo.MVC.dll in the solution. Build success. When we try to access the page that use Teleric controls, I get the exception 'Grid' is ambiguous because multiple kinds of members with this name exist in class 'Kendo.Mvc.UI.Fluent.WidgetFactory' . If I change the dll version back to 2017, error is gone and page loads just fine. How can I resolve this? Is there anything missing in the upgrade steps I did?

Thanks,

A

Anitha
Top achievements
Rank 1
Iron
 asked on 18 Mar 2022
22 answers
1.1K+ views
Hi,

I've been using the Telerik Extensions for ASP.NET MVC for about 6 months now and I was excited to try the Kendo UI MVC Extensions. However, after trying it out for a few hours I do not think it is ready to be used for my new project, I'll stick to Telerik for a bit longer. Here are the bugs (I think they're bugs) I've found so far.

1) Localization. I was happy to see the text localize when I switch the page's CurrentCulture. Somehow, the grid is properly localized BEFORE the data loads but switches back to default (en-US) as soon as the binding finishes. Currencies are not localized either.

2) Aggregates. If the grid is empty, I get a Javascript Error: Uncaught ReferenceError: count is not defined and the default "No records to display" message is not displayed. This does not happen with Telerik MVC extensions.

3) Aggregates - date format. There's a problem with grouping and displaying dates (probably related to Json). Without grouping the dates are fine, but with grouping I get: /Date(1337704107810)/ . Once again this would not happen with Telerik.

4) Horizontal scrolling. I'm not sure if this is a bug or a bad setting, but when using horizontal scrolling with a grid that has groups and aggregate Sums and Counts in the main grid footer, the footer is static, it does not scroll with the rest of the grid. This works fine with Telerik. The detail footers scroll as expected though.

Let me know if you need further details to reproduce the issues.

Thanks,
Mathieu
Anitha
Top achievements
Rank 1
Iron
 updated answer on 18 Mar 2022
6 answers
664 views

Since you would have a start and end date, how do you set up the control for DateRangePickerFor to bind to 2 fields. 

I really like the 2 calendar view with the DateRange Picker but struggling on how to wire up the binding for the post back to the controller.

Thanks

Peter

Daniel
Top achievements
Rank 3
Iron
Iron
Iron
 answered on 16 Mar 2022
2 answers
351 views

Hey guys,

I added a custom legends to my graph chart usining Legend. Item.Visual

now i want to add a link near of every legend that do something:

I tried to add labels.template with a simple string- just to check if it works before i change it to link, but it shows nothing,

I tried to googled it, but i didn't find any relevant information.

here is my chart and custom function for legens:

   

@(Html.Kendo().Chart()
   .Name("stacked-bars")

 .Legend(legend => { legend.Position(ChartLegendPosition.Left).Margin(m =>       m.Right(100)).Orientation(ChartLegendOrientation.Vertical).Item(i => i.Visual("createLegendItem"))

.Labels(l => l.Template("some text to check if works")); })

    .SeriesDefaults(seriesDefaults =>
        seriesDefaults.Column().Stack(true).Gap(10).Spacing(1.3)
    )
        .Series(series =>
        {
            series.Column(Model.Nidkha).Color("#E6BA55").Name("name1");
            series.Column(Model.Betipul).Color("#E655AE").Name("name2");

            series.Column(Model.TakinPaarKaspi).Color("#55BFE6").Name("name3");


        })

        .CategoryAxis(axis => axis
            .Categories(Model.Months.Select(m => m.ToString()).ToArray())
            .MajorGridLines(lines => lines.Visible(false))
        )
        .Panes(panes => panes.Add().Clip(false))
        .ValueAxis(axis => axis
            .Numeric()
            .Labels(labels => labels.Format("{0}").Position(ChartAxisLabelsPosition.End))
            .Line(line => line.Visible(false))
            .MajorGridLines(lines => lines.Visible(true))
        )
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Template("#= series.name #: #= value #")
        )
            )

<script>

        

function createLegendItem(e) {
        var color = e.options.markers.background;
        var labelColor = e.options.labels.color;

        var rect = new geometry.Rect([0, 0], [300,45]);
        var layout = new drawing.Layout(rect, {
            alignContent: "start",
            alignItems: "start",
            justifyContent: "end",
            lineSpacing: 40,
            orientation: "horizontal",
            prefix: "m-sd",
            revers: false,
            spacing: 2,
            wrap: false
        });

        var overlay = drawing.Path.fromRect(rect, {
            fill: {
                color: "#fff",
                opacity: 0
            },
            stroke: {
                color: "none"
            },
            cursor: "pointer"
        });

        var column = createColumn(new geometry.Rect([0, 0], [15, 10]), color);
        var label = new drawing.Text(e.series.name, [0, 0], {
            fill: {
                color: labelColor
            }
        })

        layout.append(label, column);
        layout.reflow();

        var group = new drawing.Group().append(layout, overlay);

        return group;
    }

 </script>

and this is my result:

any advice?

thanks in advance.


 

 

Ruth
Top achievements
Rank 1
Iron
Iron
 answered on 16 Mar 2022
1 answer
226 views

I have a grid that I would like to be groupable by several columns.

In the example below, it is Pattern and State.  Looking at the pattern for SMTWTFS you can see I have a button for both PA and SMTWTFS when I'd like to only have the button show for Pattern (SMTWTFS)

 

I think I only have the template on my Pattern column, so not sure why it is showing by state as well.  Is there any way I can stop it applying at the State group line too?  I've tried giving it its own group template, but with and without does not work.

 


    @(Html.Kendo().Grid<WM_SupplyChainPortal.Models.Schedule.Views.ChangeScheduleStorePattern>
    ()
    .Name("storepattern")
    .Columns(columns =>
    {
    columns.Bound(s => s.Store).Filterable(ftb => ftb.Multi(true)).Groupable(false);
    columns.Bound(s => s.StoreName).Filterable(ftb => ftb.Multi(false)).Groupable(false);
    columns.Bound(s => s.State).Filterable(ftb => ftb.Multi(true)).Groupable(true).ClientGroupFooterTemplate("");
    columns.Bound(s => s.Region).Filterable(ftb => ftb.Multi(true)).Groupable(true);
    columns.Bound(s => s.District).Filterable(ftb => ftb.Multi(true)).Groupable(true);
    columns.Bound(p => p.Pattern).Filterable(ftb => ftb.Multi(true)).ClientGroupFooterTemplate("#=value# <button class='myButton' onclick='confirmGroup(\"#=value#\")'>Edit</button>");
    })
    .Sortable()
    .PersistSelection()
    .Scrollable(s => s.Height("465px"))
    .Groupable()
    .Filterable()
    .HtmlAttributes(new { style = "height:600px;" })
    .Resizable(r => r.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
    .DataSource(dataSource => dataSource
    .Ajax()
    .Model(model => model.Id(p => p))
    .Read(read => read.Action("ChangeStorePatterns", "Schedule"))
    )
    )

Yanislav
Telerik team
 answered on 14 Mar 2022
1 answer
289 views

Hi,

I find myself in a position where I have multiple events happening at a single time/day in the Scheduler tool, and they're basically unreadable in the Week view (which is the preferred view for my target audience).  Each entry is just a sliver of color unless they go into Day view which is not a workable solution.

Screenshot is shown below.  I need my viewers to be able to see at a glance which events are happening at 9am - in this particular case, I don't care that they see it goes 9am-10am as it really just starts at 9am and runs until finished (usually a minute or two)

If it helps, all of the 8 events listed will have the same start and end time exactly (09:00-10:00).

 

The timeline week view works well, but the users will not want to scroll to see the whole week

 

Is there some css class I can overwrite, or some javascript I can put in place that will force them to stack like the timeline view, within the week view?

Ivan Danchev
Telerik team
 answered on 09 Mar 2022
0 answers
271 views

I waited for support and did not get a valid answer ... I need help as soon as possible please

I need these versions of the assemblies and when I try to browse the NuGet server in visual studio it find nothing .. and the Control Panel does not allow me to install previous versions and the versions shown are not availible for download 

There are multiple versions of files ... why would I use 2020.2.617  when the project and deployed versions are 2020.2.615.40 ?

Telerik.Web.Design, Version=2020.2.617.45

Telerik.Web.Spreadsheet, Version=2020.2.616.40

Telerik.Web.UI, Version=2020.2.617.45

Telerik.Web.UI.Skins, Version=2020.2.617.45

Telerik.Windows.Documents.Core, Version=2020.2.615.40

Telerik.Windows.Documents.Flow, Version=2020.2.615.40

Telerik.Windows.Documents.Spreadsheet, Version=2020.2.615.40

Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml, Version=2020.2.615.40

Telerik.Windows.Zip, Version=2020.2.615.40

Telerik.Reporting, Version=14.1.20.618

Telerik.ReportViewer.WebForms, Version=14.1.20.618

Stephen
Top achievements
Rank 1
Iron
 asked on 09 Mar 2022
0 answers
413 views

Hello,

I am working on Kendo Grid and wants to perform all operation server side.

For now, everything is working, except, when I call Read action and find the correct page number, and set it on the DataSourceResult, the object is found on the Grid, Selected and Highlighted as expected,
but the UI Pager value always shows 1/set to 1, no matter what Page value I have set in the DataSourceResult.

Below is my cshtml code:

@(Html.Kendo().Grid<dynamic>()
      .Name($"Grid_{Model.Name}")
      .Columns("Some Columns")
      .Pageable(Model.Pager)
      .Filterable(ftb => ftb
         .Mode(GridFilterMode.Row)
      )
      .DataSource(dataSource => dataSource
         .Ajax()
         .Read(read => read.Action("GetBrowseResults", Model.Controller, new { area = string.Format("Module/{0}", Model.Controller), theTypeToBrowse = Model.TypeToBrowse, theGroupObj = Model.IsGroupType }))
         .PageSize(Model.IsTouchDevice ? 20 : 100)
      .ServerOperation(true)
      )
      .Events(events => events.Change("LibraryRecordSelected").DataBound("LibraryDataBound"))
)

 

And here is the C# code:

public ActionResult GetBrowseResults([DataSourceRequest] DataSourceRequest theRequest, string theTypeToBrowse, string theGroupId, bool theGroupObj)
      {
         var browseResult = GetBrowseResults(theTypeToBrowse, theGroupId, theGroupObj);

         if (browseResult != null)
         {
            var ret = FilterBrowseModel(browseResult, theRequest);
            var result = Json(ret.Item1.ToDataSourceResult(ret.Item2));
            result.MaxJsonLength = int.MaxValue;
            return result;
         }
      }
          
public (List<BrowseModel>, DataSourceRequest) FilterBrowseModel(IEnumerable<BrowseModel> theBrowseModel, DataSourceRequest theDataSourceRequest)
      {
         var ret = new List<BrowseModel>();
         int total = theBrowseModel?.Count() ?? 0;

         if (total > 0)
         {
            bool reset = true;

            if (theDataSourceRequest.Page > 0 && theDataSourceRequest.PageSize > 0)
            {
                  var objectData = GetObjectData(HttpContext.Request.RequestContext.RouteData.Values["controller"].ToString());
                  if (objectData?.ObjectTxt != null)
                     theDataSourceRequest.Page = (theBrowseModel.ToList().FindIndex(x => x.ObjectTxt == objectData.ObjectTxt)) / theDataSourceRequest.PageSize + 1;
            }

            if (reset)
               ret.AddRange(theBrowseModel);
         }

         return (ret, theDataSourceRequest);
      }


Ammad
Top achievements
Rank 1
 asked on 07 Mar 2022
Narrow your results
Selected tags
Tags
Grid
General Discussions
Scheduler
DropDownList
Chart
Editor
TreeView
DatePicker
Upload
ComboBox
MultiSelect
ListView
Window
TabStrip
Menu
Installer and VS Extensions
Spreadsheet
AutoComplete
TreeList
Gantt
PanelBar
NumericTextBox
Filter
ToolTip
Map
Diagram
Button
PivotGrid
Form
ListBox
Splitter
Application
FileManager
Sortable
Calendar
View
MaskedTextBox
PDFViewer
TextBox
Toolbar
MultiColumnComboBox
Dialog
DropDownTree
Checkbox
Slider
Switch
Notification
ListView (Mobile)
Pager
Accessibility
ColorPicker
DateRangePicker
Wizard
Security
Styling
Chat
MediaPlayer
TileLayout
DateInput
Drawer
SplitView
Barcode
ButtonGroup (Mobile)
Drawer (Mobile)
ImageEditor
RadioGroup
Sparkline
Stepper
TabStrip (Mobile)
GridLayout
Template
Badge
LinearGauge
ModalView
ResponsivePanel
TextArea
Breadcrumb
ExpansionPanel
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
AppBar
BottomNavigation
Card
FloatingActionButton
Licensing
Localization
MultiViewCalendar
PopOver (Mobile)
Ripple
ScrollView (Mobile)
Switch (Mobile)
PivotGridV2
FlatColorPicker
ColorPalette
DropDownButton
AIPrompt
PropertyGrid
ActionSheet (Mobile)
BulletGraph
Button (Mobile)
Collapsible
Loader
CircularGauge
SkeletonContainer
Popover
HeatMap
Avatar
ColorGradient
CircularProgressBar
SplitButton
StackLayout
TimeDurationPicker
Chip
ChipList
DockManager
ToggleButton
Sankey
OTPInput
ChartWizard
SpeechToTextButton
InlineAIPrompt
DateTimePicker
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?