Telerik Forums
Kendo UI for jQuery Forum
3 answers
258 views

Validation used for a field in KendoGrid works fine on currently being edited cell when I try to select other cell.But It doesn't work when I try to sort any column or use filter. Is it possible to prohibit user from sorting or filtering till validation for the field passes.

Code used for validation in datasource for one of field.
01.Project:{
02.editable:true,
03.validation: {
04.custom: function(input) {
05.if(input.val()=="") {
06.input.attr("data-custom-msg", "Message");
07.return false;
08.}
09.else
10.return true;
11.}
12.}
13.}
Daniel
Telerik team
 answered on 07 Jun 2013
1 answer
6.7K+ views
Hi

I want to store selected item state. I can't trigger 'select' event properly.
    $('#groups').kendoDropDownList({
        dataSource: [
            { text: "No group", value: "none" },
            { text: "By type", value: "type_label" },
            { text: "By route", value: "route_label" },
            { text: "By status", value: "status_label" }
        ],
        dataTextField: "text",
        dataValueField: "value",
        select: function(e){
            var selectedDataItem = this.dataItem(e.item.index());
        set_global_setting ("group_state", dataItem.value);
// ... code which depends on selectedDataItem and works this.dataSource
        }
    }).data("kendoDropDownList").select(function(dataItem){
        return dataItem.value === get_global_setting("group_state");
    });
 
    var groups_dropdown = $('#groups').data("kendoDropDownList");
    groups_dropdown.trigger("select", {item : groups_dropdown.dataItem()}); // does not work since 'select' event expects 'e.item' as 'li'
When user changes selected value 'e.item' in 'select' event is a 'li'.
When I change selected value programmaticlly I should specify next selected item not as dataItem but as 'li'.
How can I do this?
Maybe I should somehow change 'selectedDataItem' definition in 'select' event?
Dimiter Madjarov
Telerik team
 answered on 07 Jun 2013
1 answer
138 views
Hi,

I have an viewmodel with an observable array of objects, and a computed selectedObject.  I'm attempting to bind a KendoListView to an observable array in selectedObject, but the ListView doesn't get updated.

There's a fiddle demonstrating the issue here:

http://jsfiddle.net/JrJ2q/3/

I'd appreciate any support you could provide.

Thanks,
John
Atanas Korchev
Telerik team
 answered on 07 Jun 2013
2 answers
100 views
Hello,

I am having a problem sorting by the column that I enabled a custom editor for. 

I basically followed the sample at http://demos.kendoui.com/web/grid/editing-custom.html 

How would you go about sorting by the "Category" column? The column it self is an object, so I think is getting confused.

Any ideas?

Thanks!
Covo
Ricardo
Top achievements
Rank 1
 answered on 07 Jun 2013
3 answers
186 views
This is for Kendo UI version 2013.1.514.340.

Here is my MVC view:

<script src="~/Scripts/jquery-1.7.1.js"></script>
<script src="~/Scripts/kendo.web.min.js"></script>
<script src="~/Scripts/kendo.aspnetmvc.min.js"></script>
<link href="~/Styles/examples.css" rel="stylesheet" />
<link href="~/Styles/kendo.common.min.css" rel="stylesheet" />
<link href="~/Styles/kendo.default.min.css" rel="stylesheet" />

@using Kendo.Mvc.UI
@model List<CV.Prototype.ViewModels.MyRecord>

@(Html.Kendo().MultiSelect()
      .Name("categoryMultiselect")
      .DataTextField("Name")
      .DataValueField("Id")
      //SERVER BINDING
          .BindTo(Model)
          .Value(Model)   
      )

My controller is simply:
        public ActionResult Index()
        {

            var x = new List<MyRecord>
                {
                    new MyRecord {Id = 1, Name = "Name1"},
                    new MyRecord {Id = 2, Name = "Name2"},
                    new MyRecord {Id = 3, Name = "Name3"},
                    new MyRecord {Id = 4, Name = "Name4"}
                };
            return View(x);
        }

All the records display inside the grey boxes, but are not inside the input text box. Also the throbber is constantly displaying. Apart from this it functions correctly both with Server and Ajax binding. Any clues as to what I might be missing?
Daniel
Telerik team
 answered on 07 Jun 2013
1 answer
279 views
Hi,

I'm not sure if this is a bug or just a misunderstanding on my part. I'm also putting this post here, but it may be more relevant for the SPA section!

When using a dropdownlist inside a view (rendered as part of an SPA layout), the following element is created at the foot of the body (as well as the normal markup):
<div style="display: none; position: absolute;" data-role="popup" id="dropdownlist1-list" class="k-list-container k-popup k-group k-reset"><ul aria-live="off" id="dropdownlist1_listbox" aria-hidden="true" role="listbox" tabindex="-1" style="overflow: auto;" unselectable="on" class="k-list k-reset">
On a view change, using layout.showIn(), I was to understand the the view and all its child elements would be removed from the DOM. As it is, these elements remain - if the view reference is retained it would appear that only one instance is created if the the view reference is recreated, a duplicate is formed when the view is rendered.

The JSFiddle here demonstrates the issue hopefully. Obviously if there are a lot of views being used with many dropdownlists, then the capacity for many of these remnants to be created could be significant. I haven't done exhaustive testing, but this doesn't seem to happen for (for example) the grid.

Grateful for any assistance!

Many thanks,

J.
Georgi Krustev
Telerik team
 answered on 07 Jun 2013
1 answer
108 views
Not sure what version of kendo  I have, but the javascript parser add-in for Visual Studio detected an anomaly in the kendo.all.min.js file -- in one place the word groupable is quoted with a single quote on the left end and a double quote on the right end.
Vladimir Iliev
Telerik team
 answered on 07 Jun 2013
1 answer
69 views
I'm not sure what version I've got, but there's a mismatched quotation mark  (single on one end , double on the other) in kendo.all.min.js.

I tried to attach  a PNG showing where it is, but there's an error message "Invalid post content".

Thanks
Vladimir Iliev
Telerik team
 answered on 07 Jun 2013
3 answers
68 views
I'm using normal drop down, with external data source, I'm selecting item using select method.
Item is properly selected on all browsers I've checked, however on mobile ones drop down is not scrolled to that selected item. On desktop browsers it is scrolled properly, on mobile not, I need to scroll to the bottom to see selected item.
Daniel
Telerik team
 answered on 07 Jun 2013
7 answers
868 views
Title says it all.  I am editing a record inline.  When I hit update, the request to the server occurs, the record is saved and the response is returned.  However, the Grid does not acknowledge the fact that the AJAX request was successful.  So the Grid stays in edit-mode.  If I cancel then refresh the grid, the row shows up as it should (saved).  No errors are occurring on the server or client.

I'm using the ASP.NET MVC Wrappers - AJAX.

<div style="width: 700px">
    @(Html.Kendo().Grid<RoleGridModel>()
        .Name("grdRoles")
        .Columns(columns =>
        {
            columns.Bound(r => r.Name).Width(200);
            columns.Bound(r => r.Description).Width(300);
            columns.Command(command => {
                if (security.CanAdd || security.CanUpdate) command.Edit();
                if (security.CanDelete) command.Destroy();
            }).Width(200);
        })
        .Groupable(grouping => grouping
            .Enabled(false))
        .Events(events => { if (security.CanAdd && !security.CanUpdate) events.DataBound("function() { this.table.find('.k-grid-edit').hide(); }"); })
        .DataSource(dataSource => dataSource
            .Ajax()
            .Model(model => model.Id(r => r.RoleId))
            .Events(events => events.Error("error_handler"))
            .Read(read => read.Action("Index", "Roles", new { area = "Setup" }))
            .Create(create => create.Action("Create", "Roles", new { area = "Setup" }))
            .Update(update => update.Action("Edit", "Roles", new { area = "Setup" }))
            .Destroy(destroy => destroy.Action("Delete", "Roles", new { area = "Setup" }))
            .Sort(sort => sort.Add(r => r.Name).Ascending())
            .PageSize(10))
        .Filterable(filtering => filtering
            .Enabled(true))
        .Editable(editable => editable.Mode(GridEditMode.InLine))
        .Pageable(paging => paging
            .Enabled(true)
            .Info(true)
            .PageSizes(false)
            .Refresh(true))
        .Scrollable(scrolling => scrolling
            .Enabled(false)
            .Height(400)
            .Virtual(false))
        .Sortable(sorting => sorting
            .Enabled(true)
            .AllowUnsort(false)
            .SortMode(GridSortMode.SingleColumn))
        .ToolBar(toolbar => { if (security.CanAdd) toolbar.Create(); })
    )
</div>

[HttpPost]
public ActionResult Edit([DataSourceRequest] DataSourceRequest request, RoleGridModel model)
{
    if (ModelState.IsValid && model != null)
    {
        try
        {
            Role r = Mapper.Map<RoleGridModel, Role>(model);
            r.AppContext = this.AppContext;
            r.SubscriberId = this.AppContext.SelectedSubscription.SubscriberId;
            r.SubscriptionId = this.AppContext.SelectedSubscription.SubscriptionId;
            r.ModifyDate = DateTime.UtcNow;
            r.IsNew = false;
            r.IsMarkedForDelete = false;
            r.HasChanges = true;
            r.Save();
        }
        catch (Exception ex)
        {
            LogException(ex);
            ModelState.AddModelError("", "Unable to update role. " + ex.Message);
        }
    }
 
    return Json(ModelState.ToDataSourceResult());
}
Vladimir Iliev
Telerik team
 answered on 07 Jun 2013
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
MultiColumnComboBox
Chat
Dialog
DateRangePicker
Checkbox
Timeline
Drawer
DateInput
ProgressBar
MediaPlayer
ImageEditor
TextBox
OrgChart
Accessibility
Effects
PivotGridV2
ScrollView
Switch
BulletChart
Licensing
QRCode
ResponsivePanel
TextArea
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
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
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?