Telerik Forums
Kendo UI for jQuery Forum
3 answers
2.2K+ views

Hi,

We're having some problems with Kendo MVC Validation when data attributes on inputs have no value.

For example (when using FluentValidation integrated with MVC) our inputs are generated as follows:

<input class="form-control text-box single-line k-invalid valid" data-val="true" data-val-number="The field Range1 must be a number." data-val-range="'Range1' must be greater than or equal to ''." data-val-range-max="" data-val-range-min="" data-val-required="'Range1' should not be empty." id="Range1" name="Range1" type="number" value="" aria-required="true" aria-describedby="Range1-error" aria-invalid="true">

 

The problematic code being: data-val-range="'Range1' must be greater than or equal to ''." data-val-range-max="" data-val-range-min=""

When using the input the error appears no matter what value you enter: Range1' must be greater than or equal to ''.

The reason these attributes are generated without values is because they are dynamic/not constant. The FluentValidation rule is that the Range field must be greater than another field on the screen.

I know that I could write custom validation for this rule but actually I am happy for the input to ignore the validation of the range in this case.

The same application works fine when using jQuery validate (jQuery validate ignores the empty range attributes and the form can be submitted).

How do I stop Kendo Validator attempting to validate this attribute? Shouldn't it ignore the attributes as they are empty (not valid), and treat the input as valid?

(image attached shows the problem)

Regards,

Chris

Boyan Dimitrov
Telerik team
 answered on 18 Jul 2017
6 answers
507 views
Here's the scenario: I have a grid that uses a shared DataSource. I add new items to the DataSource programmatically, i.e. mySharedDataSource.add(new myItemModel()), when the user clicks an Add button. The pager updates the item count properly. Now, if the user clicks the Cancel button and I call mySharedDataSource.cancelChanges(), why does the pager not update to show the correct count? Calling the Grid's refresh() function does not correct the displayed count, even though the count of items in the shared DataSource is correct.

It seems wasteful to me to call mySharedDataSource.read() just to update the pager count.
Preslav
Telerik team
 answered on 18 Jul 2017
3 answers
250 views

I have a diagram with multiple shapes.  Each shape has multiple rectangles.

1. Is there a way (do you have examples) to identify which rectangle in the shape was clicked in the Click event? 

2. Is there any mechanism to store data in the rectangles? i.e. Similar to data-id="5" in standard html. I'm pretty sure I can figure out the Id of each rectangle from the shape.dataItem - but it would be alot easier if I could store data with each rectangle.

 

Thanks!

Stefan
Telerik team
 answered on 18 Jul 2017
2 answers
506 views

First, please take a look at this simple example

<div id="view">
    <span data-bind="text: obj"></span>
    <input data-bind="value: obj.name" />
  </div
  <script>
    $(document).ready(()=> {
      let model = kendo.observable({
          obj: {
            name: "John",
            value: 15,
            toString:function(){return JSON.stringify(this);}
          }});
       
      kendo.bind($("#view"), model);
    });
  </script>

 

When html is loaded everything is fine but when field 'name' is changing, refresh is not triggered for the span. How do I trigger it ?

Veselin Tsvetanov
Telerik team
 answered on 18 Jul 2017
1 answer
150 views

Hi!, i'm trying to use a template into the same template. This is the code:

<script id="nestedTemplate" type="text/x-kendo-template">
    <li><b>#: _folderName #</b>
    <ul data-template="nestedTemplate" data-bind="source: _folders"></ul>
    <ul data-template="filesTemplate" data-bind="source: _files"></ul>
    </li>
</script>

json (remote)

{
        "_folderName": "Dpto CGE",
        "_folders": [
          {
            "_folderName": "Informes Test",
            "_folders": [
              
            ],
            "_files": [
              {
                "OriginalPath": "Comparativa de Planificación Mensual con Producción Hasta Marzo 2013.sql"
              },
              {
                "OriginalPath": "Comparativa de Planificación Mensual con Producción.sql"
              },
              {
                "FullPath": "\\\\192.168.10.6\\pfolder$\\jgperez\\Control De Gestión\\Informes Gema\\Obras.xls"
              }
            ]
          }

So, the template is calling itself each _folders is found but it doesn't works: : e.bind is not a function

Can i use nested templates with MVVM?

Thanks.

 

Dimitar
Telerik team
 answered on 18 Jul 2017
7 answers
1.3K+ views
Hello,

I need to somehow select specific tab. I was trying something like:

tabStrip.append(
            [
                {
                    id: "myId1",
                    text:title,
                    contentUrl:url
                }
            ]
        );
...
tabStrip.select("#myId1");


But it did not work. How I can do such thing (e.g. select a specific tab)? Should I count each added tab manually and select by index? How tabStrip.select works?

Thank you.
Ivan Danchev
Telerik team
 answered on 18 Jul 2017
1 answer
197 views

 I am using Kendo MVVM. This ApisTemplate is called Remotely and It opens up. Problem is in "PaxPreferenceTemplate" template. There 2 source binding. Only 1st works i.e know Even if you use <label data-bind:"text: Segment.SegmentDetailsToDisplayPricing" ></label>  still result would be same.
    Please tell what would be correct way 

Note: ALL below code is in 1 file.

 

 

<script id="ApisTemplate" type="text/x-kendo-template" class="KendoExtTemplate">
 
    <div>
        <div data-bind="source: ApisVMList.PaxPreferenceBySegment" data-template="PaxPreferenceTemplate"></div>
 
        <div style="text-align:center;">
            <button type="button" id="btnIssueTicket" onclick="SaveIssueTicket(this)" class="k-button k-primary Apis_submit " style="width: 100px; height: 25px; margin-right: 5px;">
                <i class="fa fa-floppy-o fa-inverse" aria-hidden="true"></i> Save
            </button>
 
            <button type="button" class="k-button " onclick="CloseApisWindow(this)" style="width: 100px; height: 25px;"><i class="fa fa-ban"></i> Cancel</button>
        </div>
    </div>
</script>
 
 
<script id="PaxPreferenceTemplate" type="text/x-kendo-template" class="KendoExtTemplate">
 
    <div data-bind="source: Segment" data-template="SegmentTemplate"></div>
     
    <div data-bind="source: PaxInfo" data-template="PaxInfoTemplate"></div>
 
</script>
 
<script id="SegmentTemplate" type="text/x-kendo-template" class="KendoExtTemplate">
    <label data-bind="text: SegmentDetailsToDisplayPricing"></label>
</script>
 
<script id="PaxInfoTemplate" type="text/x-kendo-template" class="KendoExtTemplate">
    <div>
        <label data-bind="text: Pax.PersonName"></label>
        <input data-role="dropdownlist"
               data-text-field="PassportNumber"
               data-value-field="PassportNumberID"
               data-bind="source: PossiblePassports" />
 
        <input data-role="dropdownlist"
               data-text-field="FrequentFlyernumber"
               data-value-field="FrequentFlyernumberID"
               data-bind="source: PossibleFrequentFlyers" />
    </div>
 
 
 
</script>

 

Dimitar
Telerik team
 answered on 18 Jul 2017
2 answers
188 views

Is there a way to customize the UI of kendo upload to show the failed uploads in a different list and succeeded ones on another? Like the following..

You are currently uploading 3 files

Failed : 2

Succeeded : 2

Uploading...

doc1

doc2

doc3

 

Failed

doc4

doc5

 

Completed

doc6

doc7

Member12221
Top achievements
Rank 1
 answered on 18 Jul 2017
5 answers
207 views

i'm writing a website using kendo grid, and now i'm stuck in displaying the Selective Data when i chose an item on the drop down list, i don't use the Filter action but instead i'm using a Ajax which will call my Jsonresult in the controller. How to make the grid show those items ? 
Here is the method in my Controller :

public JsonResult LoadSelection(Categories Option)
        {
            try
            {
                List<Product> ls = new List<Product> { };
                foreach (var item in db.Product.ToList())
                {
                    if (item.Cate_ID== Option.Cate_ID)
                        ls.Add(item);                
                }
                return new JsonResult()
                {
                    Data = ls,
                    MaxJsonLength = Int32.MaxValue,
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                };
                
            }
            catch (Exception e)
            {
                return Json(e.Message);
            }

and here is my dropdownlist handler :
 var dropdown = grid.find("#Item").kendoDropDownList({
               dataTextField: "Cate_ID",
               dataValueField: "Cate_ID",
               autoBind: false,
               optionLabel: "All",
               dataSource: Shared_Data,           
               change: function () {
                   var value = this.value();
                   if (value) {
                       Selected_Data = value;
                           $.ajax({
                               data: {"ID_LoaiKH":Selected_Data },
                               url: "/Product/LoadSelection",
                               type: "GET",
                               dataType: "json",
                               success: function()
                               {
                                   $("#grid_1").data('kendoGrid').dataSource.read();
                               }
                           });

Redfield
Top achievements
Rank 1
 answered on 18 Jul 2017
3 answers
368 views

Hi,

I have a problem to get the inner items of hierarchical grid.

This is the main grid:

 @(Html.Kendo().Grid(Model.List1)
        .Name("List1")
    .Columns(columns =>
    {
        columns.Bound(p => p.ColA).Title("ColA").Width(135);

        columns.Bound(p => p.ColB).Title("ColB").Width(110).Template(@<text>
          <a href='\\#' class='link' style="color:red;" onclick='UpdateItem(@item.ColC) '>@item.ColC</a>     
        </text>);

 })

    .Pageable()
    .Sortable()
    .Groupable()
    .DataSource(dataSource => dataSource.Server().PageSize(5))
    .HtmlAttributes(new { style = "height:500px;" })
    .DetailTemplate(

        @<text>
            @(Html.Kendo().Grid(item.InnerList)
                                    .Name("Inner_" + item.ListID)
                                    .Columns(columns =>
                                    {
                                    columns.Bound(o => o.ColD1).Title("ColD1").Width(110).HtmlAttributes(new { @class =  "btn-link", @style = "cursor: pointer;" }).HtmlAttributes(new { @onclick = "UpdateItem('"+@item.ColD1+")" })
                       
                                        columns.Bound(o => o.ColD2).Title("ColD2").Width(110);
                                    })

                                 .DataSource(dataSource => dataSource.Server())
                                 .Pageable()
                                 .Sortable()
            )
        </text>
          )

 

______________________________________________

1. In the detail template I tried add a link to column ColD1 as in column ColC with .Template but it didn't work.

So I used HtmlAttributes instead to simulate a link :

I added: @class =  "btn-link", @style = "cursor: pointer;"  and it worked.

Why can't I use the .Template in the inner grid?

 

2. When I click on the link I want to run a javascript function. I tried sending the inner item as parameter to the function (as I did successfully in the main grid with @item) but it didn't work. 

I tried to send it in many ways:

1. @item.ColD1

2. o.ColD1

3.\\#= ColD1\\#

But none of the ways worked....

I'll be glad to receive your help,

Elad.

ShareDocs
Top achievements
Rank 1
 answered on 18 Jul 2017
Narrow your results
Selected tags
Tags
Grid
General Discussions
Charts
Data Source
Scheduler
DropDownList
TreeView
MVVM
Editor
Window
DatePicker
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)
Filter
SPA
Drawing API
Drawer (Mobile)
Globalization
LinearGauge
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
Chat
MultiColumnComboBox
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
ScrollView
Switch
TextArea
BulletChart
Licensing
QRCode
ResponsivePanel
Wizard
CheckBoxGroup
Localization
Barcode
Breadcrumb
Collapsible
MultiViewCalendar
Touch
RadioButton
Stepper
Card
ExpansionPanel
Rating
RadioGroup
Badge
Captcha
Heatmap
AppBar
Loader
Security
TaskBoard
Popover
DockManager
FloatingActionButton
CircularGauge
ColorGradient
ColorPalette
DropDownButton
TimeDurationPicker
ToggleButton
TimePicker
BottomNavigation
Ripple
SkeletonContainer
Avatar
Circular ProgressBar
FlatColorPicker
SplitButton
Signature
Chip
ChipList
VS Code Extension
AIPrompt
PropertyGrid
Sankey
Chart Wizard
OTP Input
SpeechToTextButton
InlineAIPrompt
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SegmentedControl
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
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?