Telerik Forums
Kendo UI for jQuery Forum
3 answers
981 views
Hi,

I'm using the grid control in my MVC 4 application to display selected columns of records.

I don't want to edit or create items from the grid, (i.e.the grid's built in popup/inline capabilities)

I want to transition to another page to do my creates and edits.

Can I override the default behavior of the create and edit buttons?

Below is an example of my grid:

$(function () {
 
    // select the employeesGrid empty div and call the
    // kendoGrid function to transform it into a grid
    var grid = $("#employeesGrid").kendoGrid({
        // specify the columns on the grid
        columns: [
                { title: "", template: "<input type='checkbox' />" },
                { field: "FirstName", title: "First Name" },
                { field: "LastName", title: "Last Name" },
                "Title",
                "City",
                { field: "BirthDate", title: "Birthday", template: '#= kendo.toString(BirthDate,"MM/dd/yyyy") #' },
                { command: ["edit", "destroy"], title: " " }
        ],
        // the datasource for the grid
        dataSource: new kendo.data.DataSource({
            // the transport tells the datasource what endpoints
            // to use for CRUD actions
            transport: {
                read: "api/employees",
                update: {
                    // get the id off of the model object that
                    // kendo ui automatically passes to the url function
                    url: function (employee) {
                        return "api/employees/" + employee.Id
                    },
                    type: "POST"
                },
                destroy: {
                    // get the id off of the model object that
                    // kendo ui automatically passes to the url function
                    url: function (employee) {
                        return "api/employees/" + employee.Id
                    },
                    type: "DELETE"
                },
                parameterMap: function (options, operation) {
                    // if the current operation is an update
                    if (operation === "update") {
                        // create a new JavaScript date object based on the current
                        // BirthDate parameter value
                        var d = new Date(options.BirthDate);
                        // overwrite the BirthDate value with a formatted value that WebAPI
                        // will be able to convert
                        options.BirthDate = kendo.toString(new Date(d), "MM/dd/yyyy");
                    }
                    // ALWAYS return options
                    return options;
                }
            },
            // the schema defines the schema of the JSON coming
            // back from the server so the datasource can parse it
            schema: {
                // the array of repeating data elements (employees)
                data: "Data",
                // the total count of records in the whole dataset. used
                // for paging.
                total: "Count",
                model: {
                    id: "Id",
                    fields: {
                        // specify all the model fields, along with validation rules and whether or
                        // not they can be edited or nulled out.
                        FirstName: { editable: false },
                        LastName: { editable: true, nullable: false, validation: { required: true } },
                        Address: { editable: true, nullable: false, validation: { required: true } },
                        City: { editable: true, nullable: false, validation: { required: true } },
                        BirthDate: { editable: true, type: "date" }
                    }
                },
                // map the errors if there are any. this automatically raises the "error"
                // event
                errors: "Errors"
            },
            error: function (e) {
                console.log(e.statusText);
            },
            // the number of records to show per page
            pageSize: 3,
            // do paging on the server
            serverPaging: true
        }),
        // paging is enabled in the grid
        pageable: true,
        // editing happens inline, one row at a time.
        editable: "popup",
        groupable: true
    }).data("kendoGrid");
 
});
kashyapa
Top achievements
Rank 1
 answered on 10 Sep 2013
2 answers
165 views
I apologize if this is listed somewhere but I cannot find it. Is there a way to have the cursor change to a pointer on the Axis Label? Specifically if the axisLabelClick is enabled then it would be nice if the cursor changes.
Richard
Top achievements
Rank 1
 answered on 10 Sep 2013
1 answer
71 views
I am using kendogrid to display data, when i load data to grid initially number of items in the grid is zero. when i sort the column in ascending or descending order it shows number of items in the grid. 


Alexander Popov
Telerik team
 answered on 10 Sep 2013
1 answer
250 views
Hi,

I am trying to use Kendo Line Chart for my application and I want to know how i can add Lines dynamically I am using ASP.NET MVC (Razor).

So far this is what I have

@(Html.Kendo().Chart(Model.colorCart)
.Name("chart")
.Title("15°")

.Legend(legend => legend
.Position(ChartLegendPosition.Left)

)
.ChartArea(chartArea => chartArea
.Background("transparent")
)

.Series(
series =>
{
series.Line(l => l.Std_values).Name("Std"); //To be added dynamically 
series.Line(l => l.Start_values).Name("Start"); //To be added dynamically 
series.Line(l => l.Pred_values).Name("Pred"); //To be added dynamically 
series.Line(l => l.End_values).Name("End"); //To be added dynamically 
series.Line(l => l.Select_values).Name("Select"); //To be added dynamically 
}
)
Iliana Dyankova
Telerik team
 answered on 10 Sep 2013
4 answers
184 views
Hi!

I just upgraded to the latest version of Kendo UI and now my charts wont render any more when I resize my mobile browser window.

In short, this is what I do:

I have two list views. The first one shows avaiable charts to display. The second one show the actual chart.
When a user clicks on a item in the first listview, I create the chart in the click event.
I then do a app.navigate("#chartView");
(In my test, the chart is bound to a static Array of data.)

The chart is displayed correctly, but then the user tilts his/her screen, the chart is redrawn but now no series or data is displayed in the chart. Only the axis is shown.

My resize function:
$(window).resize(function() {    // for any chart or gauge widget
    $("#chart").data("kendoChart").redraw();
});

This all worked before the update, what has changed?

Regards
Per


Per
Top achievements
Rank 1
 answered on 10 Sep 2013
4 answers
289 views

Hi,
       I am using kendo chart with ajax binding.
       I need to prevent the ajax call (read) when chart initialization.
       Ajax call should occured only when firing from a button.
       Is it possible to set the Autobind property for chart?

      @(Html.Kendo().Chart<foo>()
                .Name("foo")
                       
        .Legend(legend => legend.Position(Kendo.Mvc.UI.ChartLegendPosition.Right))
        .Title("foo| ")
        
        .SeriesDefaults(seriesDefaults =>
            seriesDefaults.Column().Stack(true)
        )
        .DataSource(dataSource => dataSource
          .Read(read => read.Action("foo", "foo").Data("foo")




          )
                   .Group(group => group.Add(model => model.id))
                   .Sort(sort => sort.Add(s => s.id))
         )


       .Series(series =>
        {




            series.Column(x => x.ExecutionTime).Name(string.Empty);


        })




        .CategoryAxis(axis => axis
                    .Categories(m => m.DayFormat)








        )
        .ValueAxis(axis => axis
            .Numeric().MajorUnit(10).Title("Minutes")
        )


                  .Events(events => events.SeriesHover("onSeriesHover").SeriesClick("onSeriesClick").AxisLabelClick("onAxisLabelClick"))
                    
        )
    
Jacques
Top achievements
Rank 2
 answered on 10 Sep 2013
3 answers
413 views

I have a simple view with an AutoComplete, a MultiSelect, and an IntegerTextBox side-by-side with no other styling.

@Html.Kendo().AutoComplete().Name("AutoComplete").Placeholder("AutoComplete")
 
@Html.Kendo().MultiSelect().Name("MultiSelect").Placeholder("MultiSelect")
 
@Html.Kendo().IntegerTextBox().Name("IntegerTextBox").Placeholder("IntegerTextBox")


The AutoComplete and IntegerTextBox are the same width as each other and have the same font for the placeholder. The MultiSelect is radically different - it fills the width of the page and its placeholder has Arial font, which differs from the other two.

What's going on?

Petur Subev
Telerik team
 answered on 10 Sep 2013
1 answer
230 views
The web page, http://docs.kendoui.com/api/wrappers/aspnet-mvc/Kendo.Mvc.UI.Fluent/GridBuilder, shows an example of ClientAltRowTemplate.  Is this out of date?  When I try it, I get CS1061: Kendo.Mvc.UI.Fluent.GridBuilder<System.Data.DataRowView>' does not contain a definition for ClientAltRowTemplate'.  I am trying to set up alternate rows in a Kendo Grid using Razor syntax.
Dimo
Telerik team
 answered on 10 Sep 2013
3 answers
390 views
I have a kendo combobox with an OnSelect method defined on the page, but would like to move it to the jQuery ready function. How do I do that?
Right now, the code looks like this:
<%= Html.Kendo().ComboBox()
    .Name("contactsAc")
    .Filter("startswith")
    .Placeholder("Select a Contact")
    .MinLength(3)
    .HtmlAttributes(new { style = "width:250px;" })
    .DataSource(source => source.Read(read => read.Action("ContactSelect", "TrainingSchedule")
    .Data("onAdditionalData"))
    .ServerFiltering(true))
    .DataTextField("Name")
    .DataValueField("Id")
    .AutoBind(false)
    .Events(e => e.Select("onSelect"))
%>
<script language="javascript" type="text/javascript">
    function onSelect(e) {
        var dataItem = this.dataItem(e.item.index());
        var contact = new Object();
        contact.ContactId = dataItem.Id;
        contact.ContactName = dataItem.Name;
        vm.assignedContacts.push(contact);
        kendo.bind($(document.body), vm);
    }
</script>
I want to place it within :
$(function () {
    $("#startDate").kendoDatePicker();
    $("#endDate").kendoDatePicker();
 
    $("#detailForm").kendoWindow({
        height: "450px",
        title: "Training Schedule Detail",
        visible: false,
        width: "600px"
    }).data("detailForm");
 
    $grid.data = $("#grid").data("kendoGrid");
 
    $("#detailForm").submit(function () {
        if (validateData()) {
            formSubmit();
        }
        return false;
    });
The ready function is in an external JavaScript file that gets loaded at the bottom of the page.



Kiril Nikolov
Telerik team
 answered on 10 Sep 2013
4 answers
583 views
Hi,

Could you please anyone advise me how can i bind model class data annotation attributes using Kendo MVVM?

I have defined the Employee model class as below,

  public class EmployeeModel
    {
        public int EmployeeId { get; set; }

        [Display(Name = "Employee Name")]
        [DataType(DataType.Text)]
        [Required(ErrorMessage = "The employee name should not be empty")]
        [StringLength(50, ErrorMessage = "The employee name should be less than 50 characters length")]
        public string Name { get; set; }

        public bool IsActive { get; set; }
    }

and i have bound this model class into view page using observable object binding. I can use HTML5 attributes for validation and validate using the below Kendo validator code, EmployeeDetails - observable object.

                               <input type="hidden" id="employeeId" data-bind="value : EmployeeDetails.EmployeeId"/>
                                Name<br />
                                <input data-bind="value: EmployeeDetails.Name" type="text" id="Name" name="Name" class="k-textbox" 
                                    placeholder="Employee name" required validationMessage="Please enter employee {0}" />
                                <div></div>
                                <span class="k-invalid-msg" data-for="Name"></span>
                             
                                <input type="checkbox" data-bind="checked: EmployeeDetails.IsActive" id="Status" />


           var validator = $("#EmployeeDetailsView").kendoValidator().data("kendoValidator");

                if (!validator.validate()) {
                    $("#Name").focus();
                    return false;
                }

Now, how can i achieve the same validation by binding the  model attributes directly to input fields with HTML5 validation attributes mentioned as above?
At the same time i have to use observable object binding for elements.

Cheers,
Mahesh
Mahesh Kumar
Top achievements
Rank 1
 answered on 10 Sep 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
Drag and Drop
Map
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
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?