Telerik Forums
Kendo UI for jQuery Forum
1 answer
80 views

Hi,

I am using Kendo datepicker control for date column in MVC5 project. When we submit data and see saved data in edit, it is showing blank. It was working earlier but getting issue from last month. Is there any change in DLL. I am using Kendo.mvc.dll and version is 2014.2.1008.545. Please help. Thanks.

 

Regards,

Prakash

Viktor Tachev
Telerik team
 answered on 18 Apr 2017
1 answer
887 views

When you attach a function to the grid edit event, the parameter passed to the function contains the grid model as follows:

function onEdit(e) {
    if (e.model.isNew()) {

   ...
    }
}

I have a function in my page that sets the blur event for each cell in a row being edited. It looks as follows:

function setUpOnBlurEvent() {
    $("body").on("blur", "table tr.k-grid-edit-row input", function () {
        ...
    });
}

In the function definition above for the blur event, I need to get access to the grid model so that I can enter values in certain cells of the row being edited. How can I get access to this model. Or, is there an alternate way of inserting values into other cells in the grid row being edited from my blur event function?

 

Preslav
Telerik team
 answered on 18 Apr 2017
3 answers
230 views

I am using ASP.NET MVC Kendo UI to create a chart through using mvc code to build the chart using Plot band but its hard coded in the example below.  How can I change the plot band dynamically using the sample code provided

<div class="demo-section k-content wide">
    @(Html.Kendo().Chart<Kendo.Mvc.Examples.Models.ElectricityProduction>()
        .Name("chart")
        .Title("Spain electricity production (GWh)")
        .Legend(legend => legend
            .Position(ChartLegendPosition.Right)
        )
        .DataSource(ds => ds
            .Read(read => read.Action("_SpainElectricityProduction", "Bar_Charts"))
            .Sort(sort => sort.Add("Year").Ascending())
        )
        .Series(series =>
        {
            series.Column(model => model.Nuclear).Name("Nuclear");
            series.Column(model => model.Hydro).Name("Hydro");
            series.Column(model => model.Wind).Name("Wind");
        })
        .CategoryAxis(axis => axis
            .Categories(model => model.Year)
            .MajorGridLines(lines => lines.Visible(false))
        )
        .ValueAxis(axis => axis.Numeric()
            .Labels(labels => labels.Format("{0:N0}"))
            .MajorUnit(10000)
            .Max(70000)
            .Line(line => line.Visible(false))
            .PlotBands(bands => {
                bands.Add().From(10000).To(30000).Color("#c00").Opacity(0.3);
                bands.Add().From(30000).To(30500).Color("#c00").Opacity(0.8);
            })
        )
        .Tooltip(tooltip => tooltip
            .Visible(true)
            .Format("{0:N0}")
        )
    )
</div>
Stefan
Telerik team
 answered on 18 Apr 2017
1 answer
290 views

I have a DropdownList on my page. I have it set as follows:

@(Html.Kendo().DropDownListFor(m => m)
                        .Name("CustomerDropDown")
                        .DataTextField("DropDownText")
                        .DataValueField("RowId")
                        .OptionLabel("Select Customer or Reseller...")
                        .AutoBind(true)
                        .Filter("contains")
                        .HtmlAttributes(new { style = "width:500px" })
                        .DataSource(source =>
                        {
                            source.Read(read =>
                            {
                                read.Action("GetCustomersForPointofSaleDropDown", "Customer");
                            })
                            .ServerFiltering(true);
                        })
                        .Events(e =>
                        {
                            e.Select("onCustomerSelect").DataBound("onDropDownListBound");
                        })
                    )

Under certain circumstances I don't want the drop down list to auto bind. I don't see a Bind event I can latch on to, like I can with the data bound event, in order for me to prevent the binding from happening. Is there some way I can prevent the auto binding before it actually occurs?

Dimitar
Telerik team
 answered on 18 Apr 2017
1 answer
442 views

I have a grid (MVC) with the following set:

                .Editable(editable => editable.Mode(GridEditMode.InLine))   
                .Navigatable()                                         

               .Selectable(selectable => selectable 

                    .Mode(GridSelectionMode.Single)
                    .Type(GridSelectionType.Row))

When the user creates a new row, or when editing an existing row, I need to be able to trap when the user changes the value in a cell and moves out of the cell. I need to be able to take the new contents of the cell that changed and do some processing on it. How can I do this?

Viktor Tachev
Telerik team
 answered on 18 Apr 2017
5 answers
2.4K+ views

Hi 

I have been reading that there is a save event which gets triggered when a cell is left in the grid. I tried that and its working fine when I use GridEditMode.InCell as the edit mode. When I use GridEditMode.InLine nothing happens when I leave the cell (the function is not being called). But, the function is being called after i click on the "Update" button. In my scenario, i need to update some cells regarding to what was written in some other cells, so no use for me to call the function just before saving. So is there a method to notify me just when a cell has been left (or a value inside of a cell has been changed or selected e.g. from an autocomplete)

 

Here is my code

 

 @(Html.Kendo().Grid<Telerik2.Models.LeistungViewModel>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(l => l.LeistungNr).Width(240).Visible(false);
            columns.Bound(l => l.Bezeichnung).Width(190);
            columns.Bound(l => l.Datum).EditorTemplateName("DatumPicker").Width(110).Format("{0:dd.MM.yyyy}");
            columns.Bound(l => l.MinT).Width(110); ;
            columns.Bound(l => l.Kuerzel).EditorTemplateName("LeistungKuerzel").Width(130);
            columns.Bound(l => l.MinV).Width(110);
            columns.Bound(l => l.Person).Width(160);
            columns.Command(command => { command.Edit().Text("Bearbeiten").UpdateText("Speichern").CancelText("Abbrechen"); }).Width(200);
            
        })
        
        .ToolBar(toolbar => toolbar.Create())
                .Editable(editable => editable.Mode(GridEditMode.InLine))
                .Pageable()
                .Events(events => events.Save("Save"))
                .Sortable()
                        .Resizable(resize => resize.Columns(true))
                .Scrollable()
 

)

<script type="text/javascript">
    function Save(e) {
        console.log("Cell left");
            }
    }

</script> 

 

Konstantin Dikov
Telerik team
 answered on 18 Apr 2017
1 answer
1.8K+ views

Hello,

I was wondering if there is some kind of automatic display of custom or model errors. To check this out, I created an example in the dojo.

When the returned data contains the property defined as errors within the model, the error callback is called. But I would have expect that it creates an error message within the Grid like it does with No records available (but maybe in red). Instead the grid remains empty, neither displaying the custom error nor saying No records available.

Is there a way to enable displaying custom errors within the Grid itself like the No records available message? Or will I have to push some DOM elements there by myself in the error function? If the later, is there an event which is called when no model/custom error is there anymore so I know when to remove my DOM elements showing the error?

For short reference here the last grid example from my dojo which just creates an empty grid:

01.$('#grid3').kendoGrid({
02.  columns: [{field: 'name'},{field: 'age'}],
03.  dataSource: new kendo.data.DataSource({
04.    data: { apiError: ['Server is under maintainance!'] },
05.    schema: { errors: 'apiError' },
06.    error: function(e) {
07.      console.error('grid error:', e);
08.    },
09.  }),
10.  noRecords: true,
11.});
Stefan
Telerik team
 answered on 18 Apr 2017
1 answer
820 views

In my MVC grid, I'm trapping the Edit event as follows:

 .Events(events => events.Change("gridRowChange").Edit("onEdit"))

In my onEdit() method that gets called when an edit is occurring, I'd like to get a reference to the text box elements for each editable cell in the row so that I can attach an onBlur event to some of them. How do I go about getting a reference to each text box element in the row being edited?

Konstantin Dikov
Telerik team
 answered on 18 Apr 2017
2 answers
265 views

Hello,

I am currently using Kendo as a simple text editor inside a web form.  I am using it in 2 places 1 is editable and 1 is view only.  I am doing it this way because of the default styling of the html that is saved renders the same on the view only box.  Is there any way to resize the view only box to the size of the content in classic mode?

Thanks,

Aaron
Top achievements
Rank 1
 answered on 17 Apr 2017
2 answers
172 views

I'm in a situation where I need to use a custom function to scrape pasted clipboard data for raw image data and replace that with custom markup, but also need to support standard options like msTags and msAllFormatting. My thinking is that I'll need to write code into my custom function which manually calls the Kendo Editor methods that run the pasteCleanup option handlers. Is this right?

Has anyone done this before? There doesn't appear to be any native option to do what I'm talking about.

Wes
Top achievements
Rank 1
 answered on 17 Apr 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?