Telerik Forums
UI for ASP.NET MVC Forum
2 answers
1.8K+ views

Have a grid with a checkbox column and with a client template that includes a master checkbox.  Im able to check/uncheck all checkboxes.  However now I need to only check those that are not disabled.  Checkbox click event passes "ele" to this method checkAll.  Check/uncheck all works, but how to check first if the disabled property is set?

01.function checkAll(ele) {
02.    var state = $(ele).is(':checked');
03.    var grid = $('#MyGridList').data().kendoGrid;
04.    $.each(grid.dataSource.view(), function () {
05.       //$(".chkbx").prop("checked", state);
06. 
07.       //todo dont allow disabled lines to be selected
08.        if ($(".chkbx").prop("disabled") == false) {
09.            console.log("check checkbox");
10.        }
11.        else {
12.            console.log("dont check checkbox");
13.        }
14. 
15.    });
16. 
17.}

 

Neli
Telerik team
 answered on 13 Jan 2021
16 answers
1.3K+ views
I'm using kendo scheduler and I want to use server validation. When server returns validation error (via ModelState - ToDataSourceResult extension) then I want to show them in popup. Now I have problem how to prevent editor window to be closed?

I have following code (it works for grid popup editor and server validation errors):
onError: function (args) {
  if (args.errors) {
    var scheduler = $("#scheduler").data("kendoScheduler");
 
    scheduler.one("dataBinding", function (e) {
      e.preventDefault(); // cancel grid rebind if error occurs - this prevents window to closing 
 
      /* some error handling */
    });
  } else {
    alertify.error("Unknown error occurred");
  }
}
I found following code which looks like a bug. This is "refresh" method od scheduler. I think that it should check result of trigger("dataBinding") and call _destroyEditable when event wasn't prevented:
this.trigger("dataBinding");
 
if (!(e && e.action === "resize" && this.editable)) {
  this._destroyEditable();
}
Here's code from grid which works good:
if (that.trigger("dataBinding", { action: e.action || "rebind", index: e.index, items: e.items })) {
  return;
}
I'm using kendo version 2013.2.918.
Veselin Tsvetanov
Telerik team
 answered on 12 Jan 2021
1 answer
942 views
I was expecting to get either null or a date object out of the parser, always.  However i discovered when we tried to parse the number 253 that you'll end up with this error:  Uncaught TypeError: e.indexOf is not a function at ... (where ... is the kendo file and location).

It seems to work ok if you .toString() everything.
Georgi
Telerik team
 answered on 12 Jan 2021
1 answer
258 views

I have a grid in my web application(ASP.NET MVC). When I was testing it with NVDA Screen reader, NVDA reads its header and data(Content) section separately, like they are two different tables. May be this issue is due to two different table tags are used for header and grid content, that's why NVDA is reading it separately. How to solve this issue to make sure that NVDA recognize grid header and content as a single table only.

Alex Hajigeorgieva
Telerik team
 answered on 12 Jan 2021
1 answer
682 views

I added Kendo.Mvc.dll (2018.3.1017.545) to my mvc project in vs2019.

I write this code in my index.cshtml file.
@(Html.Kendo().Editor() .Name("Test") .HtmlAttributes(new { style = "width: 100%; height:840px" }) .Tools(tools => tools .Clear() .Bold().Italic().Underline() .JustifyLeft().JustifyCenter().JustifyRight() .InsertUnorderedList().InsertOrderedList() .Outdent().Indent() .CreateLink().Unlink() .InsertImage() .TableEditing() .FontName() .FontSize() .BackColor() .FontColor() ) .ImageBrowser(imageBrowser => imageBrowser .Image("~/shared/UserFiles/Images/{0}") .Read("Read", "ImageBrowser") .Create("Create", "ImageBrowser") .Destroy("Destroy", "ImageBrowser") .Upload("Upload", "ImageBrowser") ) .Value(@<text> </text>) )

and I added this using at top of my file:

@using Kendo.Mvc.UI

and I added these Scripts to _layout:

<script src="~/Scripts/kendo/kendo.all.min.js"></script>

<script src="~/Scripts/kendo/kendo.aspnetmvc.min.js">

</script><script src="~/Scripts/kendo/kendo.editor.min.js"></script>

even once I added all .js and .css file of kendo, but not worked.

but in chrome I see an empty TextArea.

what else should I do to fix it?

thanks

Dimo
Telerik team
 answered on 12 Jan 2021
1 answer
204 views

Hi,

I have a grid with a subgrid. A column in the parentgrid is calculated based on the sum of columns in the subgrid. When editing a column the value is saved properly. I have to do a refresh/read of the grids to show the new value. This is working properly. But after the refresh it is not visible for the user which row he just edited because everything is collapsed. How can I expand the row after the save to show the subgrid?

Kind regards,

Roel Alblas

Alex Hajigeorgieva
Telerik team
 answered on 12 Jan 2021
1 answer
724 views

Hi,

I like to render a column in the MVC grid with a dynamically rendered field with a color hex. This is in a subgrid wich is generated like below:

.ClientDetailTemplateId("templateSubTasks")

I know that when using a hashtag in a template grid you have to proceed it with two \ I also know that when using a hashtag for example a color hex, you have to proceed it with 4 \. But what when the color hex is loaded with a value from the data property like  #= data.TaskLabel?data.TaskLabel.Color:'' #

Her you can see the column I create in the parent grid. This has to be adjusted for use in a subgrid as a template.

columns.Bound(c => c.TaskLabel).Title(Order.clmLabel).ClientTemplate("<div style='border-radius: 3px; display:inline; width: 8px; height: 18px; background-color: #= data.TaskLabel?data.TaskLabel.Color:'' #'>&nbsp; </div><span style='margin-left:10px'> #= data.TaskLabel?data.TaskLabel.Name:'' #</span>").Width(100).Encoded(false).EditorTemplateName("GridDropdownEditorLabel");

I didn't succeed with adding \\\\ to the property data.TaskLabel.Color.

Do you have any idea?

Kind regards,

Roel Alblas

Martin
Telerik team
 answered on 12 Jan 2021
1 answer
596 views

Hello,

Does anyone have an idea how to keep check box check status when changed page? 

I added check box as a ( ClientTemplate) column, user can check or uncheck them. but check box's value was removed after page moving. How to keep those status?  Thanks in advance.

Georgi Denchev
Telerik team
 answered on 11 Jan 2021
1 answer
473 views

Hello,

 

in C# I've got 2 ViewModels:

```

public class TestListViewModel

{

    public string Param { get; set; }

    public IEnumerable<TestViewModel> Counts { get; set; }

}

```

 

```

public class TestViewModel

{

    public string Name { get; set; }

    public int Count { get; set; }

}

```

 

now I will pass IEnumerable<TestListViewModel> as model to grid. How can I get the result like this: https://demos.telerik.com/aspnet-mvc/grid/aggregates?

I don't need to aggregate any data because it's already done. I just need to fill this grid somehow.

It's my local data, so the Grid will starts with:

```

@(Html.Kendo().Grid(Model)

    .Name("grid")

    .Columns(columns => (?))

    (...)

)

```

Anton Mironov
Telerik team
 answered on 11 Jan 2021
2 answers
147 views

Another 'Invalid Template' error ... there are tons out there, and I thought I'd find my answer, but no.

The hierarchy (nested) grid below works great until I uncomment line 58 or 67.  Then I get the invalid template error.

I've escaped my hash symbols on line 52 as I read in a ton of other posts.

Does anyone spot anything amiss???

TIA

001.@(Html.Kendo().Grid<OrgViewModel>()
002.    .Name("Grid")
003.    .Columns(columns =>
004.    {
005.        columns.Bound(e => e.OrgType).Hidden(true);
006.        columns.Bound(e => e.OrgId).Hidden(true);
007.        columns.Bound(e => e.OrganizationType).Title("Partner or Charter");
008.        columns.Bound(e => e.OrgName).Title("Name");
009.    })
010.    .Filterable(filterable => filterable
011.        .Extra(false)
012.        .Operators(operators => operators
013.            .ForString(str => str.Clear()
014.                .StartsWith("Starts with")
015.                .IsEqualTo("Is equal to")
016.                .IsNotEqualTo("Is not equal to")
017.            ))
018.    )
019.    .Groupable()
020.    .Pageable(m => m.PageSizes(new[] { "20", "50", "100", "All" }))
021.    .Resizable(resizable => resizable.Columns(true))
022.    .Sortable()
023.    .Scrollable(s => s.Enabled(true))
024.    .ClientDetailTemplateId("template")
025.    .HtmlAttributes(new { style = "height:850px;" })
026.    .DataSource(dataSource => dataSource
027.        .Ajax()
028.        .PageSize(20)
029.        .Read(read => read.Action("Orgs_Read", "FiscalContacts"))
030.        .Sort(sort =>
031.        {
032.            sort.Add(x => x.OrgName);
033.            sort.Add(x => x.OrgType);
034.        })
035.    )
036.    .Events(events => events.DataBound("dataBound"))
037.    )
038. 
039.@section scripts {
040.<script id="template" type="text/kendo-tmpl">
041.    @(Html.Kendo().Grid<FiscalContactViewModel>()
042.        .Name("Grid_#=OrgType#_#=OrgId#") // template expression, to be evaluated in the master context
043.        .Columns(columns =>
044.        {
045.            //columns.Command(command => { command.Edit(); }).Width(250);
046.            columns.Bound(o => o.Id).Hidden(true);
047.            columns.Bound(o => o.SalesforceId).Hidden(true);
048.            columns.Bound(o => o.LastName);
049.            columns.Bound(o => o.FirstName);
050.            columns.Bound(o => o.Title);
051.            columns.Bound(o => o.Email);
052.            columns.Bound(x => x.ExecComm).Title("Exec").Width(75).Filterable(true).ClientTemplate("\\#=ExecComm ? 'Yes': ''\\#").HtmlAttributes(new { style = "text-align:center" });
053.            columns.Bound(o => o.Roles);
054.            columns.Bound(o => o.FiscalPermissions).Title("Perms").Width(75);
055.        })
056.        .ToolBar(tools =>
057.        {
058.            //tools.Create();
059.            tools.Excel();
060.        })
061.        .Excel(excel => excel
062.            .FileName("Fiscal Contacts.xlsx")
063.            .Filterable(true)
064.            .AllPages(true)
065.            .ProxyURL(Url.Action("Excel_Export_Save", "FiscalContacts"))
066.        )
067.       
001.@(Html.Kendo().Grid<OrgViewModel>()
002.    .Name("Grid")
003.    .Columns(columns =>
004.    {
005.        columns.Bound(e => e.OrgType).Hidden(true);
006.        columns.Bound(e => e.OrgId).Hidden(true);
007.        columns.Bound(e => e.OrganizationType).Title("Partner or Charter");
008.        columns.Bound(e => e.OrgName).Title("Name");
009.    })
010.    .Filterable(filterable => filterable
011.        .Extra(false)
012.        .Operators(operators => operators
013.            .ForString(str => str.Clear()
014.                .StartsWith("Starts with")
015.                .IsEqualTo("Is equal to")
016.                .IsNotEqualTo("Is not equal to")
017.            ))
018.    )
019.    .Groupable()
020.    .Pageable(m => m.PageSizes(new[] { "20", "50", "100", "All" }))
021.    .Resizable(resizable => resizable.Columns(true))
022.    .Sortable()
023.    .Scrollable(s => s.Enabled(true))
024.    .ClientDetailTemplateId("template")
025.    .HtmlAttributes(new { style = "height:850px;" })
026.    .DataSource(dataSource => dataSource
027.        .Ajax()
028.        .PageSize(20)
029.        .Read(read => read.Action("Orgs_Read", "FiscalContacts"))
030.        .Sort(sort =>
031.        {
032.            sort.Add(x => x.OrgName);
033.            sort.Add(x => x.OrgType);
034.        })
035.    )
036.    .Events(events => events.DataBound("dataBound"))
037.    )
038. 
039.@section scripts {
040.<script id="template" type="text/kendo-tmpl">
041.    @(Html.Kendo().Grid<FiscalContactViewModel>()
042.        .Name("Grid_#=OrgType#_#=OrgId#") // template expression, to be evaluated in the master context
043.        .Columns(columns =>
044.        {
045.            //columns.Command(command => { command.Edit(); }).Width(250);
046.            columns.Bound(o => o.Id).Hidden(true);
047.            columns.Bound(o => o.SalesforceId).Hidden(true);
048.            columns.Bound(o => o.LastName);
049.            columns.Bound(o => o.FirstName);
050.            columns.Bound(o => o.Title);
051.            columns.Bound(o => o.Email);
052.            columns.Bound(x => x.ExecComm).Title("Exec").Width(75).Filterable(true).ClientTemplate("\\#=ExecComm ? 'Yes': ''\\#").HtmlAttributes(new { style = "text-align:center" });
053.            columns.Bound(o => o.Roles);
054.            columns.Bound(o => o.FiscalPermissions).Title("Perms").Width(75);
055.        })
056.        .ToolBar(tools =>
057.        {
058.            //tools.Create();
059.            tools.Excel();
060.        })
061.        .Excel(excel => excel
062.            .FileName("Fiscal Contacts.xlsx")
063.            .Filterable(true)
064.            .AllPages(true)
065.            .ProxyURL(Url.Action("Excel_Export_Save", "FiscalContacts"))
066.        )
067.        //.Editable(editable => editable.Mode(GridEditMode.InCell))
068.        .DataSource(dataSource => dataSource
069.            .Ajax()
070.            .PageSize(10)
071.            .Read(x => x.Action("ListContacts", "FiscalContacts", new { orgType = "#=OrgType#", orgId = "#=OrgId#" }))
072.            .Create(x => x.Action("FiscalContacts_Create", "FiscalContacts", new { orgType = "#=OrgType#", orgId = "#=OrgId#" }))
073.            .Update(x => x.Action("FiscalContacts_Update", "FiscalContacts"))
074.            .Model(model =>
075.            {
076.                model.Id(x => x.Id);
077.                model.Field(x => x.Id).Editable(false);
078.                model.Field(x => x.FiscalPermissions).Editable(false);
079.            }).Sort(sort =>
080.            {
081.                sort.Add(x => x.LastName);
082.                sort.Add(x => x.FirstName);
083.            })
084.        )
085.        .Filterable(filterable => filterable
086.            .Extra(false)
087.            .Operators(operators => operators
088.                .ForString(str => str.Clear()
089.                    .StartsWith("Starts with")
090.                    .IsEqualTo("Is equal to")
091.                    .IsNotEqualTo("Is not equal to")
092.                ))
093.        )
094.        .Groupable()
095.        .HtmlAttributes(new { style = "height:600px;" })
096.        .Pageable(m => m.PageSizes(new[] { "20", "50", "100", "All" }))
097.        .Resizable(resizable => resizable.Columns(true))
098.        .Sortable()
099.        .Scrollable(s => s.Enabled(true))
100.        .ToClientTemplate()
101.    )
102.</script>
103.    <script>
104.        function dataBound() {
105.            this.expandRow(this.tbody.find('tr.k-master-row').first());
106.        }
107.</script>
108.}
.Editable(editable => editable.Mode(GridEditMode.InCell))
068.        .DataSource(dataSource => dataSource
069.            .Ajax()
070.            .PageSize(10)
071.            .Read(x => x.Action("ListContacts", "FiscalContacts", new { orgType = "#=OrgType#", orgId = "#=OrgId#" }))
072.            .Create(x => x.Action("FiscalContacts_Create", "FiscalContacts", new { orgType = "#=OrgType#", orgId = "#=OrgId#" }))
073.            .Update(x => x.Action("FiscalContacts_Update", "FiscalContacts"))
074.            .Model(model =>
075.            {
076.                model.Id(x => x.Id);
077.                model.Field(x => x.Id).Editable(false);
078.                model.Field(x => x.FiscalPermissions).Editable(false);
079.            }).Sort(sort =>
080.            {
081.                sort.Add(x => x.LastName);
082.                sort.Add(x => x.FirstName);
083.            })
084.        )
085.        .Filterable(filterable => filterable
086.            .Extra(false)
087.            .Operators(operators => operators
088.                .ForString(str => str.Clear()
089.                    .StartsWith("Starts with")
090.                    .IsEqualTo("Is equal to")
091.                    .IsNotEqualTo("Is not equal to")
092.                ))
093.        )
094.        .Groupable()
095.        .HtmlAttributes(new { style = "height:600px;" })
096.        .Pageable(m => m.PageSizes(new[] { "20", "50", "100", "All" }))
097.        .Resizable(resizable => resizable.Columns(true))
098.        .Sortable()
099.        .Scrollable(s => s.Enabled(true))
100.        .ToClientTemplate()
101.    )
102.</script>
103.    <script>
104.        function dataBound() {
105.            this.expandRow(this.tbody.find('tr.k-master-row').first());
106.        }
107.</script>
108.}
Kim
Top achievements
Rank 1
Veteran
 answered on 11 Jan 2021
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
Licensing
Rating
ScrollView
ButtonGroup
CheckBoxGroup
NavBar
ProgressBar
QRCode
RadioButton
Scroller
Timeline
TreeMap
TaskBoard
OrgChart
Captcha
ActionSheet
Signature
DateTimePicker
AppBar
BottomNavigation
Card
FloatingActionButton
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
TimePicker
StockChart
RadialGauge
ContextMenu
ArcGauge
AICodingAssistant
+? more
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Edmond
Top achievements
Rank 1
Iron
fabrizio
Top achievements
Rank 2
Iron
Veteran
RobMarz
Top achievements
Rank 2
Iron
Fakhrul
Top achievements
Rank 1
Iron
Tejas
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?