Telerik Forums
Kendo UI for jQuery Forum
4 answers
145 views
I'm seeing conflicting information regarding support for the HTML5 History API in Kendo. I can't find any mention of it in the docs, but I do see a comment about how history is implemented in SPA via the Router using page fragments (#stuff). I do not want to use page fragments. Instead, I want to use the HTML5 History API.
I submitted a feature request for this, but it was declined because it is apparently already supported:
http://feedback.kendoui.com/forums/127393-kendo-ui-feedback/suggestions/4183941-support-html5-history-api

Where is it supported and is there any documentation I can look at to see how to use it?
Josh
Top achievements
Rank 1
 answered on 07 Nov 2014
1 answer
190 views
Hi there, 

I have a grid with the clientRowTemplate and the ability to reorder columns. I'm saving the reordered columns state and retrieving on the next user login, when I call the grid.reorderColumn() on$(window).ready(), the columns are getting reordered but the rows are not. If i removethe clientrowtemplate, the rows are getting reordered too. Is there a way to reorder the rows along with the columns keeping the clientRowTemlpate on the grid? 
@(Html.Kendo().Grid<JobRequest>()
    .Name("Jobs")
    .Columns(columns =>
    {
        columns.Bound(m => m.Job_Name)
            .Width(110);
        columns.ForeignKey(m => m.TimeFrame, (IEnumerable<TimeFrameType>)Model.timeFrames, "TimeDiff", "TimeDiffName")
            .Filterable(filter => filter
                .Extra(false)
                .Operators(operators => operators
                    .ForNumber(str => str.Clear()
                        .IsLessThan("Less Than")
                    )
                    .ForString(str => str.Clear()
                        .IsEqualTo("Less Than")
                    ))
             )
            .Width(110);
        columns.Bound(m => m.Started)
            .Width(75).Filterable(false).
            Format("{0:MM/dd hh:mm}");
        columns.Bound(m => m.Run_Time)
            .Width(75)
            .Title("Run Time").Filterable(false);
        columns.Bound(m => m.Last_Update)
            .Width(75)
            .Format("{0:MM/dd hh:mm}").Filterable(false);
        columns.Bound(m => m.Job_Priority)
            .Width(40);
        columns.Bound(m => m.Job_ID)
            .ClientTemplate("<a href='javascript:showJobSetWindow(#=Job_ID#)'>#=Job_ID#</a>")
            .Width(90);
        columns.ForeignKey(m => m.Job_Class, (System.Collections.IEnumerable)ViewData["jobClass"], "Value", "Text")
            .Width(85);
        columns.Bound(m => m.WF_Name)
            .Width(200);
        columns.Bound(m => m.User_ID)
            .Width(75);
        columns.Bound(m => m.Division)
            .Width(75);
        columns.Bound(m => m.Cust_Ref)
            .Width(85);
        columns.ForeignKey(m => m.JobStatus, (System.Collections.IEnumerable)ViewData["jobStatus"], "Value", "Text")
            .Width(85);
        columns.ForeignKey(m => m.StepStatus, (System.Collections.IEnumerable)ViewData["stepStatus"], "Value", "Text")
            .Width(85);
        columns.Bound(m => m.Task_Name)
            .Filterable(false)
            .Width(270);
        columns.Bound(m => m.User_System)
            .Width(100);
        columns.ForeignKey(m => m.JobStatus, (System.Collections.IEnumerable)ViewData["jobStatus"], "Value", "Text")
           .Width(85)
           .Title("eReport");
    })
    .Events(events => events
        .FilterMenuInit("filterMenuInit").ColumnReorder("colReorder")
    )
    .ClientRowTemplate(
        "<tr class='clr#:JobStatus#'>" +
        "<td>#: Job_Name #</td>" +
        "<td>#: TimeFrame #</td>" +
        "<td>#: kendo.toString(Started, 'MM/dd hh:mm') #</td>" +
        "<td>#: Run_Time #</td>" +
        "<td>#: kendo.toString(Last_Update, 'MM/dd hh:mm') #</td>" +
        "<td>#: Job_Priority #</td>" +
        "<td><a href='javascript:showJobSetWindow(#=Job_ID#)'>#=Job_ID#</a></td>" +
        "<td>#: Job_Class #</td>" +
        "<td>#: WF_Name #</td>" +
        "<td>#: User_ID #</td>" +
        "<td>#: Division #</td>" +
        "<td>#: Cust_Ref #</td>" +
        "<td># if(JobStatus == \"ERRORED\"){#<a href='javascript:showJobLogWindow(#=Job_ID#)'>#=JobStatus#</a></td>#}else{##=JobStatus##} #</td>" +
        "<td>#: StepStatus #</td>" +
        "<td>#: Task_Name #</td>" +
        "<td>#: User_System #</td>" +
        "<td># if(JobStatus==\"COMPLETED\"){#<a href='javascript:showeReportsWindow(#=Job_ID#)'>View</a></td>#}else{}#</td>"+
         "</tr>"
    )
    .Pageable()
    .Sortable()
    .Scrollable(a => a.Height("auto"))
    .Resizable(resize => resize.Columns(true))
    .Reorderable(reorder => reorder.Columns(true))
    .Filterable(filterable => filterable
        .Enabled(true)
        .Extra(true)
        .Messages(m => m.IsTrue("Yes"))
        .Messages(m => m.IsFalse("No"))
        .Operators(operators => operators
            .ForString(str => str
                .Clear()
                .Contains("Contains")
                .DoesNotContain("Not Contains")
                .StartsWith("Starts with")
                .EndsWith("Ends with")
            )
        )
    )
    .DataSource(dataSource => dataSource
        .Ajax()
        .ServerOperation(true)
        .PageSize(20)
        .Events(e => e.RequestEnd("onReqEnd"))
        .Read(read => read.Action("ReadData", "Home")
        .Data("ReadData"))
    )
 
)

This is the function i'm calling on Window.ready
function reorderCheck() {
       var grid = $("#Jobs").data("kendoGrid");
       var cols = grid.columns;
       //var cs = JSON.parse($.cookie("colState"));
       var cs;
       var userSetting = '@Model.UserSetting'.replace('columns=', '').replace(/"/g, '"');
       if (userSetting != "")
           cs= JSON.parse(userSetting);
       var curColumns=grid.columns;
       if (cs) {
           if (cs.length > 0) {
               for (var i = 0; i < cs.length; i++) {
                  var curColState = cs[i];
               
                   $.map(grid.columns, function (elementOfArray, indexInArray) {
                       if (elementOfArray.field == curColState.field) {
                           grid.reorderColumn(i, grid.columns[indexInArray]);
                            
                       }
                   });
                  
               }
           }
       }
   }



Thanks!
Phani
Dimo
Telerik team
 answered on 07 Nov 2014
6 answers
2.4K+ views
Is there a way to pass additional data the button's click event? I need to pass information from the data item that the button is on (ListView template) to the function handling the click event.

Thanks!
Dimo
Telerik team
 answered on 07 Nov 2014
2 answers
197 views
Hello,

Is there a way to define something like an AngularJs ng-click handler  for your toolbar buttons, so that you don't have to manually call $apply?

As an example, here is what I currently do:
$scope.paymentToolbarOptions = {
    items: [{
    type: "button", id: "manualIr", text: "Manual IR", overflow: "always"
    }...],
    click: function (e) {
        if (e.id === "manualIr") {
         $scope.$apply(function() { $scope.payManualIr(); });
        }
  }
};

Thanks,
Lars


Alexander Valchev
Telerik team
 answered on 07 Nov 2014
2 answers
436 views
Hi,

I prepared solution for save Kendo grid state into database and load it. I have problem, because if I click Load state everything was loading correctly but toolbar with standard create command disappear. Please help I don't know what I'm doing wrong.

This is code for save/load state:

function save_state() {
        var grid = $("#Projects").data("kendoGrid");

        var dataSource = grid.dataSource;

        var state = {
            columns: grid.columns,
            toolbar: grid.options.toolbar,

            page: dataSource.page(),
            pageSize: dataSource.pageSize(),
            sort: dataSource.sort(),
            filter: dataSource.filter(),
            group: dataSource.group()
        };

        $.ajax({
            url: "/Projects/Save",
            data: {
                data: JSON.stringify(state)
            }
        });
    }

    function load_state() {
        var grid = $("#Projects").data("kendoGrid");

        var dataSource = grid.dataSource;

        $.ajax({
            url: "/Projects/Load",
            success: function (state) {

                var loaded_state = JSON.parse(state);

                var options = grid.options;

                options.columns = loaded_state.columns;

                options.dataSource.page = loaded_state.page;
                options.dataSource.pageSize = loaded_state.pageSize;
                options.dataSource.sort = loaded_state.sort;
                options.dataSource.filter = loaded_state.filter;
                options.dataSource.group = loaded_state.group;

                grid.destroy();

                $("#Projects")
                .empty()
                .kendoGrid(options)
            }
        });
    }

There is Kendo Grid definition code:

@(Html.Kendo().Grid<issueTracker.Model.Project>()
    .Name("Projects")
    .Pageable()
    .Columns(col => 
        {
            col.Bound(p => p.ProjectID).Hidden(true);
            col.Bound(p => p.ProjectName);
            col.Bound(p => p.Description);
            col.Bound(p => p.ImagePath);
            col.Command(comm => { comm.Edit(); comm.Destroy(); });
        })
    .ToolBar(t => t.Create())
    .Sortable()
    .Filterable()
    .ColumnMenu()
    .Editable(edit => edit.Mode(GridEditMode.InLine))
    .DataSource(dt => dt
        .Ajax()
        .Read(r => r.Action("GetData", "Projects"))
        .PageSize(20)
        .ServerOperation(false)
        .Events(e => e.Error("error_handler"))
        .Update(u => u.Action("UpdateProject", "Projects"))
        .Destroy(u => u.Action("DeleteProject", "Projects"))
        .Create(u => u.Action("CreateProject","Projects"))
        .Model(m => m.Id(p => p.ProjectID)))

)

Cezary
Top achievements
Rank 1
 answered on 07 Nov 2014
8 answers
529 views
How would I add icons in a horizontal row on a linear chart?  As I figure it, I would need to do two things:
  1. First, I would need to "extend" the chart's vertical "majorGridLines" so that there was room to add a row of icons/images without overlapping the data.
  2. Second, I would need a method to add an image for each x-axis point and be able to specify the y-location (position) at which it was drawn.  Ideally, the the image's file name would come from the data set.
Is this what chart annotations are intended to handle?  I have not been able to find any information on annotations, other than they were introduced in 2013 Q2.

I have attached an image of what I am describing. 

Thank you for your assistance.
Iliana Dyankova
Telerik team
 answered on 07 Nov 2014
2 answers
377 views
Hi,

All code below runs on NodeJS/Express/EJS.
I have a two file form.js and grid.js.

In the form.js I create grid object and define custom validator like here:
-------------------------------------------------------------------------------------------------
...
rest.get(uri, {}).on('complete', function (data, result) {
         var schemeGridColumns = {};
         ...
         schemeGridColumns["field1"].validation = {
                                                                          required: true,
                                                                          custom: function (input) {
                                                                                  if (input.is("[name=field1]") && input.val().length > 5)  {
                                                                                          input.attr("data-custom-msg", "My notification from validator.");
                                                                                          return false;
                                                                                   }
                                                                                   return true;
                                                                    }
       ...
       var grid = {
              editable: {
                    mode: "popup",
                    ....
              },
             transport: {
             ..... 
             },
             ...
            dataSource: {
                   ....
                   schema: {
                          data: 'data',
                          total: 'total',
                          model: {
                               id: gridKeys,
                               fields: gridSchemaFields
                          }
                   }
            },
           ....
      };

      res.render("grid.js", grid: grid, ....);
)};
--------------------------------------------------------------------------
File grid.js looks like this:
----------------------------------------------------------------------------
<div id="grid" style1="float:left"></div>
<div class="clear1"></div>

<script language="javascript">
    $(document).ready(function() {
        titan.setTitle('<%= title %>');

        // create Kendo UI Grid
        $('#grid').kendoGrid(<%- JSON.stringify(grid) %>);

    });
</script>
--------------------------------------------------------------------------------
The problem is that standard validation require works in popup,
but custom doesn't fire. I've tried with inline mode. Result is the same.
May be problem with EJS template compiler?






Ilya
Top achievements
Rank 1
 answered on 07 Nov 2014
5 answers
419 views
I have an MVC 4, EF 5 model first project with these models:
  • Contractor
  • Profile
Between these two is a many-to-many relation. (in the background EF generates a ContractorProfiles table and I'm can get a list of profiles for a contractor by calling Contractor.Profiles)
I would like to use the MultiSelectFor to be able to select one or more profiles for my contractor and directly bind it to my viewmodel but I don't know how to do this.
How can this be done?
Daniel
Telerik team
 answered on 07 Nov 2014
1 answer
189 views
Hello,

is it possible to use the groupFooterTemplate with multiple group? It seems like only the footertemplate works.
Here is an example. I want to display the count in every group and subgroup, e.g. employees -> female -> count=2 and also employee -> count=4

01.<!DOCTYPE html>
02.<html>
03.<head>
04.    <meta charset="utf-8">
05.    <title>Kendo UI Snippet</title>
06. 
08.    <link rel="stylesheet" href="http://cdn.kendostatic.com/2014.2.716/styles/kendo.rtl.min.css">
13. 
14.    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
16.</head>
17.<body>
18.   
19.<div id="grid"></div>
20.<script>
21.$("#grid").kendoGrid({
22.  columns: [
23.    { field: "name"},
24.    { field: "typ", footerTemplate: "Employees Total: #=count#"},  //Works fine
25.    //{ field: "typ", footerTemplate: "Employees Total: #=count#", groupFooterTemplate: "Count: #=count#"}, //Doesn't work :-(
26.    { field: "gender" },
27.    { field: "age" }  
28.     
29.  ],
30.  dataSource: {
31.    data: [
32.      { name: "Jane Doe", age: 30, typ: "customer", gender: "female"},
33.      { name: "John Doe", age: 32, typ: "customer", gender: "male" },
34.      { name: "Jodi Doe", age: 30, typ: "customer", gender: "female" },
35.      { name: "Jim Doe", age: 32, typ: "customer", gender: "male" },
36.       
37. 
38.      { name: "jens", age: 34, typ: "employee", gender: "male" },
39.      { name: "Anna", age: 36, typ: "employee", gender: "female" },
40.      { name: "Karl", age: 34, typ: "employee", gender: "male" },
41.      { name: "Gustav", age: 36, typ: "employee", gender: "female" }
42.    ],
43.     
44.    group: [{field: "typ", aggregate:"count"},{field: "gender", aggregate:"count"}],
45.     
46.    aggregate: { field: "typ", aggregate: "count" }
47.             
48.  }
49.});
50.</script>
51.</body>
52.</html>


Thanks in advance

Kind regards

Jens Borowy
Jens
Top achievements
Rank 1
 answered on 07 Nov 2014
3 answers
540 views
I have a kendo grid with command columns to delete row, and a button outside grid to delete multiple rows.

my problems: 

I want to disable confirm box of outside button but keep confirmbox of command column.

How to do it?
Rosen
Telerik team
 answered on 07 Nov 2014
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?