Telerik Forums
Kendo UI for jQuery Forum
17 answers
446 views
I use the custom download tool http://www.telerik.com/download/custom-download to get the smallest package possible but when a Kendo UI update is released I always find it hard to remember exactly which components I need to include in the download that I used last time. It would be helpful to include all the ticked items in the downloaded JS as comments at the top of the file. 
Kiril Nikolov
Telerik team
 answered on 14 Nov 2016
1 answer
83 views
I want the content to be divide into two lines. But as per [this][1] thread the template function does not allow a line break. So I tried setting `connectionDefaults.content.visual` with the below function:


            var getConnection = function (data) {
            var g = new kendo.dataviz.diagram.Group({
                autoSize: true
            });
            var text1 = new kendo.dataviz.diagram.TextBlock({
                text: data.label.name,
                fontSize: 16
            });


            g.append(text1);

            var text2 = new kendo.dataviz.diagram.TextBlock({
                text: data.label.value,
                fontSize: 16
            });


            g.append(text2);
            return g;
        }
But the problem here is that the `data` field does not populate the connection data due to which assigning values is not possible.


A solution for this is much appreciated.


  [1]: http://www.telerik.com/forums/split-labels-over-multiple-lines
Vessy
Telerik team
 answered on 14 Nov 2016
1 answer
447 views

Hi Kendo Team,

I have a MVC DatePicker as so: 

@(Html.Kendo().DatePicker()
  .Name("FromDate")
  .HtmlAttributes(new { style = "width: 150px" })
  .Min(new DateTime(2013, 01, 01))
  .Value(DateTime.Today.Date)
  .Format("dd MMM yyyy")
  .HtmlAttributes(new { @class = "form-control" })
)

However, whenever I selected a value, it always throws error message "The field ToDate must be a date." This only occurs after I have migrated my solution to Kendo 2016.3.1028. At first I thought it was due to culture info but kendo culture is set to "en-SG" which should take the format "dd MMM yyyy".

Thank you,

Minh Pham.

Boyan Dimitrov
Telerik team
 answered on 14 Nov 2016
1 answer
480 views

Recently I got one important problem that all my kendo grid delete button are not working.

But create and update button work fine.

I didn't know when this happened, because my recent developing function not contain delete button.

Here's one of my code:

 

        @(Html.Kendo().Grid<Template.Areas.BasicInfo.Models.COMM_ItemList>()
    .Name("grid")
    .Columns(columns =>
    {
        columns.ForeignKey(p => p.ListName, (System.Collections.IEnumerable)ViewData["ListName"], "ItemValue", "ItemName").Width(100);
        //columns.Bound(p => p.ItemIndex).Width(120);
        columns.Bound(p => p.ItemName).Width(120);
        columns.Bound(p => p.ItemValue).Width(120);
        columns.Bound(p => p.ItemMemo).Width(120);
        columns.Command(command =>
        {
            command.Edit().Text("修改");
            command.Destroy().Text("刪除");
        }).Width(160);
    })
    .ToolBar(toolbar =>
    {
        toolbar.Create().Text("新增");
        toolbar.Excel().Text("匯出Excel");
        //toolbar.Save();
    })
    .Editable(editable => editable.Mode(GridEditMode.PopUp))
    .Pageable(pager => pager.Input(true).Numeric(true).Info(true).PreviousNext(true).Refresh(true).PageSizes(true))
    .Sortable(sortable => sortable.AllowUnsort(true).SortMode(GridSortMode.MultipleColumn))
    .Scrollable()
    .Reorderable(reorder => reorder.Columns(true))
    .Resizable(resize => resize.Columns(true))
    .Excel(excel => excel.FileName(ViewBag.Title + ".xlsx"))
    .HtmlAttributes(new { style = "height:400px;width:100%" })
    .Events(events => events.Edit("edit").Save("onSave"))
    .DataSource(dataSource => dataSource
        .Ajax()
        //.Batch(false)
        //.ServerOperation(false)
        .PageSize(10)
        .Events(events => events.Error("error_handler"))
        .Model(model =>
        {
            model.Id(p => p.ListName);
            //model.Id(p => p.ItemIndex);
            //model.Field(p => p.CreateUserId).DefaultValue(User.Identity.Name); //設定CreateUserId的預設值
        })
        .Create(Create => Create.Action("COMM_ItemList_Create", "ItemListSetting"))
        .Read(Read => Read.Action("COMM_ItemList_Read", "ItemListSetting"))
        .Update(Update => Update.Action("COMM_ItemList_Update", "ItemListSetting"))
        .Destroy(Destroy => Destroy.Action("COMM_ItemList_Destroy", "ItemListSetting"))
        )
    )

 

 

 

namespace Template.Areas.BasicInfo.Controllers
{
    public class ItemListSettingController : BaseApiController
    {
        // GET: BasicInfo/ItemListSetting
        public ActionResult Index()
        {
            try
            {
                ItemList();
                return View();
            }
            catch (Exception ex)
            {
                logger.Error(ex, "ItemListSettingController");
                return new JavaScriptResult { Script = "alert('" + ex.ToString() + "');" };
            }
        }


        public ActionResult COMM_ItemList_Read([DataSourceRequest] DataSourceRequest request)
        {
            try
            {
                //var LimsMntList = db.COMM_ItemList.Where(o => o.ListName == "LimsMntList").ToList();
                return Json(db.COMM_ItemList.Where(o => o.ListName != "LimsMntList").ToDataSourceResult(request));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "ItemListSettingController");
                return new JavaScriptResult { Script = "alert('" + ex.ToString() + "');" };
            }
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult COMM_ItemList_Update([DataSourceRequest] DataSourceRequest request, COMM_ItemList o)
        {
            try
            {
                if (o != null && ModelState.IsValid)
                {
                    db.Entry(o).State = System.Data.Entity.EntityState.Modified;
                    //o.LastUpdate = User.Identity.Name;
                    //o.UpdateTime = DateTime.Now;
                    db.SaveChanges();
                }
                return Json(new[] { o }.ToDataSourceResult(request, ModelState));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "ItemListSettingController");
                return new JavaScriptResult { Script = "alert('" + ex.ToString() + "');" };
            }
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult COMM_ItemList_Create([DataSourceRequest] DataSourceRequest request, COMM_ItemList o)
        {
            try
            {
                if (o != null && ModelState.IsValid)
                {
                    var q = db.COMM_ItemList.Where(m => m.ItemName == o.ItemName || m.ItemValue == o.ItemValue).ToList();
                    if (q.Count > 0)
                    {
                        return new JavaScriptResult { Script = "alert('!!');$('#grid').data('kendoGrid').dataSource.read();" };
                        //RedirectToAction("UserIndex", new JavaScriptResult { Script = "alert('!');" });
                    }
                    else
                    {
                        var num = db.COMM_ItemList.Where(i => i.ListName == o.ListName).Max(i => i.ItemIndex).ToString();
                        o.ItemIndex = Convert.ToInt16(Convert.ToInt16(num) + 1);
                        db.COMM_ItemList.Add(o);
                        db.SaveChanges();
                    }
                }
                return Json(new[] { o }.ToDataSourceResult(request, ModelState));
            }
            catch (Exception ex)
            {
                logger.Error(ex, "ItemListSettingController");
                return new JavaScriptResult { Script = "alert('" + ex.ToString() + "');" };
            }
        }

        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult COMM_ItemList_Destroy([DataSourceRequest] DataSourceRequest request, COMM_ItemList o)
        {
            if (o != null)
            {
                try
                {
                    COMM_ItemList Item = db.COMM_ItemList.Find(o.ListName, o.ItemIndex);
                    db.COMM_ItemList.Remove(Item);
                    db.SaveChanges();                  
                }
                catch (Exception ex)
                {
                    logger.Error(ex, "ItemListSettingController");
                    return new JavaScriptResult { Script = "alert('" + ex.ToString() + "');" };
                }
            }
            return Json(new[] { o }.ToDataSourceResult(request, ModelState));
        }
    }
}

 

 

    public class COMM_ItemList
    {
        [Key]
        [Required]
        [Column(Order = 1)]
        [UIHint("ItemList_ListName")]
        public string ListName { get; set; }
        [Key]
        [Required]
        [Column(Order = 2)]
        public short ItemIndex { get; set; }
        [Required]
        public string ItemName { get; set; }
        [Required]
        public string ItemValue { get; set; }
        //public string ValueType { get; set; }
        public string ItemMemo { get; set; }
    }



Jalen
Top achievements
Rank 1
 answered on 14 Nov 2016
4 answers
1.4K+ views
Can i export grid with image in excel
Nikolay
Telerik team
 answered on 11 Nov 2016
5 answers
287 views

After downloading KendoUI v 2016.3.914, I noticed that the way the AMD dependencies are defined has changed since previous versions (I'm working off of v2015.3.1111 for reference). In the newer versions of KendoUI, each component appears to define all of the common functionality it will need in separate AMD definition blocks. For instance, dataviz.barcode.js now has sections for "util/main", "util/text-metrics", "util/base64", "mixins/observers", and the actual "kendo.dataviz.barcode" component. In v2015.3.1111 and before, there was only the block for "kendo.dataviz.barcode". This is the case for a number of components, many of which contain the exact same definitions for those common AMD definitions (for instance, util/main is defined in multiple files) which means that we are loading unnecessarily large files if we load multiple files with the same common dependencies. 

 

I realize that the reason for the change was to allow components to work more autonomously, but I was wondering if there is any distribution of the Kendo assets which behaves more like the older versions of Kendo and strip out the common AMD dependencies to core files, or to individual files per dependency? I know that the current versions contain files like kendo.all.js and kendo.web.js for common functionality, but I was hoping to avoid these larger files. Essentially, we want a similar setup to how v2015.3.1111 where all modules appear only once (i.e. we don't want to repeatedly see util/main in different files) with their dependencies. For our case, we dynamically combo-load kendo assets based on what a particular page of ours needs, so we need to understand the dependency tree prior to loading the page and don’t want to load duplicates.

Alex Hajigeorgieva
Telerik team
 answered on 11 Nov 2016
9 answers
859 views

Hi!

I was testing this demo:http://dojo.telerik.com/iVIja

I tried to set the clearButton to true/false - but there is not differnce in the output. (In both cases, there is no a clear button on the right side of the multiselect)

What's the problem?

thnx:Attila

Rumen
Telerik team
 answered on 11 Nov 2016
3 answers
201 views

I have a KendoUI Grid that is made up of several checkbox columns (screenshot attached). I'm having a problems getting the values to my controller. Below is the code I have for the grid. How do I pass checkbox values to my controller?

<div style="width: 1400px; clear: both;">        
        @(Html.Kendo().Grid<MVCTimesheetApplication.Models.REAP>()
            .Name("timesheetGrid")
            .TableHtmlAttributes(new { style = "table-layout: fixed; " })
            .Columns(columns =>
            {
                columns.Bound(t => t.Project).Title("Project").HtmlAttributes(new { style = "white-space: nowrap;" }).EditorTemplateName("ReadOnlyTemplate");
                columns.Bound(t => t.DisplayTask).Title("Task").HtmlAttributes(new { style = "white-space: nowrap;" }).EditorTemplateName("ReadOnlyTemplate");
                columns.Bound(t => t.IndirectId).EditorTemplateName("ReadOnlyTemplate");
                columns.Bound(t => t.State).Width(100).HtmlAttributes(new { style = "text-align: center;" }).EditorTemplateName("ReadOnlyTemplate");
                columns.Bound(t => t.Sunday).Width(75).HtmlAttributes(new { style = "text-align:center" }).ClientTemplate("<input type='checkbox' id='cbd#= Task #' />").Title(String.Format("Sun<br />{0}", ((DateTime)Session["startDate"]).ToString("M/d")));
                columns.Bound(t => t.Monday).Width(75).HtmlAttributes(new { style = "text-align:center" }).ClientTemplate("<input type='checkbox' id='cbd#= Task #' />").Title(String.Format("Mon<br />{0}", ((DateTime)Session["startDate"]).AddDays(1).ToString("M/d")));
                columns.Bound(t => t.Tuesday).Width(75).HtmlAttributes(new { style = "text-align:center" }).ClientTemplate("<input type='checkbox' id='cbd#= Task #' />").Title(String.Format("Tue<br />{0}", ((DateTime)Session["startDate"]).AddDays(2).ToString("M/d")));
                columns.Bound(t => t.Wednesday).Width(75).HtmlAttributes(new { style = "text-align:center" }).ClientTemplate("<input type='checkbox' id='cbd#= Task #' />").Title(String.Format("Wed<br />{0}", ((DateTime)Session["startDate"]).AddDays(3).ToString("M/d")));
                columns.Bound(t => t.Thursday).Width(75).HtmlAttributes(new { style = "text-align:center" }).ClientTemplate("<input type='checkbox' id='cbd#= Task #' />").Title(String.Format("Thu<br />{0}", ((DateTime)Session["startDate"]).AddDays(4).ToString("M/d")));
                columns.Bound(t => t.Friday).Width(75).HtmlAttributes(new { style = "text-align:center" }).ClientTemplate("<input type='checkbox' id='cbd#= Task #' />").Title(String.Format("Fri<br />{0}", ((DateTime)Session["startDate"]).AddDays(5).ToString("M/d")));
                columns.Bound(t => t.Saturday).Width(75).HtmlAttributes(new { style = "text-align:center" }).ClientTemplate("<input type='checkbox' id='cbd#= Task #' />").Title(String.Format("Sat<br />{0}", ((DateTime)Session["startDate"]).AddDays(6).ToString("M/d")));
                columns.Bound(t => t.TotalHours).Width(75).EditorTemplateName("GridDecimal").Title("Hours").HtmlAttributes(new { style = "white-space: nowrap;text-align:center;" });
            })
            .Navigatable()
            .Editable(editable =>
            {
                editable.DisplayDeleteConfirmation(false);
                editable.Mode(GridEditMode.InCell);
            })
            .DataSource(dataSource => dataSource
                .Ajax()
                .Batch(true)
                .ServerOperation(false)
                //.Events(events => events.Error("timesheetGrid_error_handler"))
                //.Events(events => events.RequestEnd("timesheetGrid_requestEnd"))
                .Model(model => model.Id(t => t.RowID))
                .Read(read => read.Action("REAP_Read", "Home"))
                .Update(update => update.Action("REAP_Update", "Home"))
            )
        .Events(events => events.DataBound("updateColumnTitles"))
        )
    </div>

Here is my model code...

public class REAP
    {
        [Key]
        public int RowID { get; set; }
        public string TimesheetID { get; set; }        
        public string Project { get; set; }
        public string DisplayProject { get; set; }
        public string Task { get; set; }
        public string DisplayTask { get; set; }
        public string IndirectId { get; set; }
        public string EarningsCodeId { get; set; }
        public string CostCategoryId { get; set; }
        public string State { get; set; }
        public bool Sunday { get; set; }
        public bool Monday { get; set; }
        public bool Tuesday { get; set; }
        public bool Wednesday { get; set; }
        public bool Thursday { get; set; }
        public bool Friday { get; set; }
        public bool Saturday { get; set; }
        public decimal TotalHours { get; set; }        
    }

And the code in my controller...

public ActionResult REAP_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<REAP> reap)
        {
            string userID = Session["UserID"].ToString();
            string timesheetID = Session["TimesheetID"].ToString();
            int retCode = 0;            

            if (reap != null)
            {
                string INSERT_QUERY_NEW = "INSERT INTO RCS_TIME_SHEET_REAP (TIME_SHEET_ID, WEEK_ENDING, PROJECT, TASK, INDIRECT_ID, STATE, SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY) " +
                                          "VALUES (@timesheetID, @weekEnding, @project, @task, @indirectID, @state, @sunday, @monday, @tuesday, @wednesday, @thursday, @friday, @saturday);";            

                using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["VTAConnectionString"].ConnectionString))
                {
                    SqlCommand cmd = new SqlCommand(INSERT_QUERY_NEW, conn);
                    CreateREAPParameters(cmd);

                    conn.Open(); 

                    foreach (var row in reap)
                    {
                        try
                        {
                            cmd.Parameters["@timesheetID"].Value = timesheetID;
                            cmd.Parameters["@weekEnding"].Value = "11/5/2016";
                            cmd.Parameters["@project"].Value = row.Project;
                            cmd.Parameters["@task"].Value = row.Task ?? "";
                            cmd.Parameters["@indirectID"].Value = row.IndirectId ?? "";
                            cmd.Parameters["@state"].Value = row.State ?? "";
                            cmd.Parameters["@sunday"].Value = row.Sunday;
                            cmd.Parameters["@monday"].Value = row.Monday;
                            cmd.Parameters["@tuesday"].Value = row.Tuesday;
                            cmd.Parameters["@wednesday"].Value = row.Wednesday;
                            cmd.Parameters["@thursday"].Value = row.Thursday;
                            cmd.Parameters["@friday"].Value = row.Friday;
                            cmd.Parameters["@saturday"].Value = row.Saturday;

                            cmd.ExecuteScalar();
                        }
                        catch(Exception ex)
                        {
                            string x = ex.Message;
                        }
                    }                  

                    conn.Close();
                }
            }

            return this.Json(new { retCode = retCode });
        }

Thanks

 

Danail Vasilev
Telerik team
 answered on 11 Nov 2016
1 answer
204 views

Hello,

I'm having the following problem with Kendo Angular Spreadsheet directive:

When I add two lines(2 and 3 for example) on the spreadsheet and then call dataSource.sync(), if line 2 returns an error from the server and the line 3 a success, and I call dataSource.sync() again, line 3 will be created again. When looking at the network calls, I can see that 2 POST requests are sent every time, even if one line was successfully created.

I made some research on this forum and found this post which describes a similar problem with a grid: http://www.telerik.com/forums/kendo-ui-grid-inserts-updates-create-duplicate-records#5qPMIWOM4UmWkpStr_17Ag

But I checked and my server returns the newly inserted item, but it seems that the dataSource does not update its internal data.

When I add 2 lines and the 2 POST requests return a success, the spreadsheet update correctly its internal data, and if I call dataSource.sync() again, no more POST requests will be made.

Thanks !

Stefan
Telerik team
 answered on 10 Nov 2016
14 answers
493 views

Hello, after much trial and error I've managed to remote bind my Grid to a Datasource and update it.  However, it appears it ONLY updates if I'm changing at least 2 cells in a row.  If I only change 1 cell, the update event does not fire.

I suspect the is either a Schema, Model or Data Binding issue.

$(kendoGrid).kendoGrid({
    dataSource: {
        transport: {
            read: {
                url: "Personnel/GetPersonnel",
                type: "GET",
                dataType: "json"
            },
            update: {
                url: "Personnel/PutPersonnel",
                type: "PUT",
                beforeSend: function (xhr, data) {
                    var json = JSON.parse(data.data);
                    data.url += '?=' + json.id;
                    xhr.setRequestHeader('id', json.id);
                },
                contentType: "application/json; charset=utf-8"
            },
            parameterMap:
                function (options, operation) {
                    if (operation !== "read") {
                        return JSON.stringify(options);
                    }
                }
        },
        schema: {
            data: "data",
            total: "total",
            model: {
            "id": "id",
          }
        },
        fields: {
          id: { "editable": false },
          employeeNumber: { "editable": false },
          loginName: { },
          firstName: { },
          middleName: { },
          lastName: { },
          site.name: { },
          state.stateName: { },
          isMechanic: { "editable": false },
          isDriver: { "editable": false }
        }
      }
});

Ryan
Top achievements
Rank 1
 answered on 10 Nov 2016
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
Licensing
ScrollView
Switch
TextArea
BulletChart
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
TimePicker
FloatingActionButton
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
StockChart
ContextMenu
DateTimePicker
RadialGauge
ArcGauge
AICodingAssistant
SmartPasteButton
PromptBox
SegmentedControl
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?