Telerik Forums
UI for ASP.NET Core Forum
1 answer
260 views

Hello,

 

I saw the demo here: http://demos.telerik.com/aspnet-core/grid/checkbox-selection

I'm trying to do the same, but I can't get it to work.
this is my code: 

 

       @(Html.Kendo().Grid<CalculationResultModel>()
.Name("Grid")
.Columns(columns =>
{
    columns.Select().Width(50);
   ...
})
.Events(ev => ev.Change("onChange"))
   .DataSource(dataSource => dataSource
     .Ajax()
     .ServerOperation(true)
     .Model(model => model.Id(m => m.CalculationRequestIdentification))
     .Read(read => read.Action("x", "x").Type(HttpVerbs.Get))

     )
        )

when I call the selectedKeyName() function in the javascript, I get an empty array.

Any Idea why that can be? The Id is a Guid btw.

 

Thanks!

 

 

Steven
Top achievements
Rank 1
 answered on 22 Nov 2017
10 answers
641 views

Hello,

I'm having some grid's - some with paging or grouping (Expanded and Collapsed) where I want to search for a specific row (Model_Id) and

select that row (if it is a grouped row it should be expand)...

  • I know that I can get the dataitem with
var dataItem = $("#grid").data("kendoGrid").dataSource.get(id);

but does this work also in a paged grid?

  • If I find the row how to select this row if it is on another page?
  • If I select the row and it is in a Group which is colapsed - how to expand that Group?

robert

 

 

 

 

Robert Madrian
Top achievements
Rank 1
Veteran
Iron
 answered on 22 Nov 2017
2 answers
122 views
I'm having some troubles trying to display events in the Scheduler, maybe casued by DateTime format.

My scheduler configuration is the following:

@(Html.Kendo().Scheduler<BookingSchedulerDto>()
    .Name(“Scheduler")
    .Date(DateTime.Now)
    .StartTime(Model.Start)
    .EndTime(Model.End)
    .Editable(m => m.TemplateId("editor"))
    .Views(views =>
    {
        views.DayView(view => view.Selected(true));
        views.WeekView();
        views.MonthView();
        views.AgendaView();
    })
    .Timezone("Etc/UTC")
    .DataSource(d => d
        .Events(e =>
        {
            e.Error("onError");
        })
        .Model(m =>
        {
            m.Id(f => f.Id);
            m.Field(f => f.Start);
            m.Field(f => f.End);
            m.Field(f => f.Title).DefaultValue("Nessun titolo");
            m.Field(f => f.IsAllDay).DefaultValue(false);
            m.Field(f => f.Name);
        })
        .Create("Update", "Booking")
        .Read("Read", "Booking")
        .Update("Update", "Booking")
        .Destroy("Delete", "Booking")
    )
)

where the Model.Start and Model.End are DateTime types. 
The BookingSchedulerDto entity properties Start and End are also DateTime objects. An example of result of read method is
[
  {
   …,
    "StartTimezone": "Etc/UTC",
    "EndTimezone": "Etc/UTC",
    "RecurrenceRule": null,
    "Start": "2017-11-07T20:16:54.073+01:00",
    "End": "2017-11-07T23:16:54.073+01:00",
    "Id": 4,
   …
  },
  {
      …
  }
]

The problem here is that events are not rendered in the scheduler as expected. What am I doing wrong? Is the result date format correct? Any other causes?
Davide Vernole
Top achievements
Rank 2
 answered on 21 Nov 2017
1 answer
301 views

Dear All,

Can you help me :)

I want to get value from dropdownlist in popup in grid.I have dropdownlist TransactionId,i want get automactically value in field outstanding Amount whatever in transaction id is primary key from outsatnding amount. 

 

My view:

<div>
    @(Html.Kendo().Grid<DevRedsMk3.Models.NpvCalculation>()
        .Name("NpvCalculation")
        .Columns(columns =>
        {
            columns.Bound(p => p.NpvCalculationId).Hidden();
            columns.ForeignKey(p => p.TransactionId, (System.Collections.IEnumerable)ViewData["custTrans"], "TransactionId", "TransactionId").Title("TransactionId ID");
            columns.Bound(p => p.LastPayment).Title("Last Payment");
            columns.Bound(p => p.OutstandingAmount).Title("Outstanding Amount");
            columns.Bound(p => p.Installment).Title("Installment");
            columns.Bound(p => p.Interest).Title("Interest");//Title("Interest").Editable(false)

            columns.Command(command => { command.Edit(); command.Destroy(); }).Width(150);
            columns.Command(c => c.Custom("OK").Text("OK").Click("OK"));
        })
        .ToolBar(toolbar =>
        {
            toolbar.Create();
        })
        .Events(e => {  e.DataBound("onchangeevent"); })
        .Editable(editable => editable.Mode(GridEditMode.PopUp))
        .Scrollable(s => s.Height(570))
        .Sortable()
        .Pageable(pageable => pageable
            .Refresh(true)
            .PageSizes(true)
            .ButtonCount(5))
        .DataSource(datasource => datasource
             .Ajax()
             .ServerOperation(false)
             .Model(model =>
             {
                 model.Id(p => p.NpvCalculationId);
                 model.Field(p => p.Interest).Editable(false);

             })

             .Read(read => read.Action("List", "NpvCalculations"))
             .Update(update => update.Action("Update", "NpvCalculations"))
             .Create(create => create.Action("Create", "NpvCalculations"))
             .Destroy(destroy => destroy.Action("Destroy", "NpvCalculations"))

        )
    )

    <script type="text/javascript">
        function OK(e) {
            e.preventDefault();
            var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
            
            $.ajax({
                url: "/NpvCalculations/GenerateNpvBaru",
                //data: dataItem.id,
                //data: { 'TransactionId': dataItem.TransactionId },
                data: { TransactionId: dataItem.TransactionId },
                success: function (response) {
                    //$('#viewDetails').html(response);
                    //alert('Approve done...');
                }
            });
        }
    </script>

    <script>
        function onchangeevent() {
            $('#OutstandingAmount').val('10000');
        }

    </script>

</div>

 

 

Thanks for your help,

 

Regards,

 

Madeck

Stefan
Telerik team
 answered on 20 Nov 2017
4 answers
239 views

 

This is (in short) my Grid code:

@(Html.Kendo().Grid<Model>()
.Name("Grid")
.Columns(columns =>
{
 
    columns.Bound(p => p.From).Format("{0:dd.MM.yyyy}").Width(150).Filterable(f => {
        f.UI("DateTimeFilter");
        f.Cell(cell => cell.ShowOperators(false));
    });
})

.Filterable(filterable => filterable
.Extra(false)
      .Operators(operators => operators
          .ForString(str => str.Clear()
              .Contains("Contains")
          ).ForDate( date => date.Clear()
         .IsGreaterThan("After")
         .IsLessThan("Before")
          )
          .ForNumber(number => number.Clear()
        .IsGreaterThan("Higher than")
        .IsLessThan("Lower than")
          ))

      )
    .Sortable()
    .Scrollable()
    .DataSource(dataSource => dataSource

        .Ajax()
        .ServerOperation(false)
        .Read(read => //get some data)
        
     )
        )

 

The fact is that p.From is treated as a String (so he gets the filter of a string = .ForString(...)). 

How is this possible? the format is also not aplied, but that works when i do this: .ClientTemplate("#= From? kendo.toString(kendo.parseDate(From), 'dd/MM/yyyy') : '' #")

 

Anybody expirienced this problmen yet?

Stefan
Telerik team
 answered on 17 Nov 2017
3 answers
192 views

I added a autocomplete control on a page. when I open the page as a popup the control works fine but when I open the page inside a master it is causing a javascript issue. When I debugged I found out that the control offset parent property is returning null. I am attaching the error. If someone can help that would be great.

Uncaught TypeError: Cannot read property 'left' of undefined
    at c.DropDown._getDropDownHorizontalOffset ()
    at c.DropDown.position ()
    at c.DropDown._onDropDownReflowed ()
    at b.DropDown.trigger ()
    at b.DropDown.reflow ()

 

   

Ianko
Telerik team
 answered on 17 Nov 2017
1 answer
240 views

I have a groupable grid which contains more than 1000 rows. It takes a long time to load it, and what's more, it makes a browser works much slower. Sometimes it is almost impossible to scroll the grid because of the low performance. 

So to reduce loading time and to improve scrolling flow I added a paging to the grid. (screen 1)
As the result, on the first page when I collapse the group my grid looks like on the screen 2.

It makes no sense to show it like this. I'd like to show the next group right behind the collapsed group,
like on the screen 3 (mock).

Can you give me a solution how can I solve it? Maybe you have any other idea? 

If you give me an example how to improve the performance without injecting the paging - we're done. 
We can think about Virtual Scroll as well, or even turning the filtering off on the client side - is it possible?

 

Stefan
Telerik team
 answered on 17 Nov 2017
4 answers
186 views

Hello,

I want to define which buttons are displayed in the toolbar in which not. In Kendo its possible by passing arrays to the sections of the toolbar (Home, Insert, Data). In .NET Core I am configurating the toolbar in my CSHTML file and can only pass booleans to the sections i.e. .Toolbar(t => t.Home(true).Data(false).Insert(false))

Btw. the documentation has a wrong description here: http://docs.telerik.com/aspnet-mvc/api/Kendo.Mvc.UI.Fluent/SpreadsheetBuilder#methods-Toolbar(System.Action%3CKendo.Mvc.UI.Fluent.SpreadsheetToolbarSettingsBuilder%3E) because it says I should pass a boolean (maybe just copied from the .Toolbar() above).

When I change the option after init in Javascript with "...options.toolbar.home = [['bold', 'italic'], 'format'];", the spreadsheet is not updated.

I really need a solution for this asap.

Richard
Top achievements
Rank 1
 answered on 15 Nov 2017
6 answers
561 views

Why dropdown with bind to Enum and OptionLabel when initialized is set to first value of enum and not to OptionLabel

@Html.Kendo().DropDownListFor(model => model.Education).OptionLabel("Please choose...").BindTo(Html.GetEnumSelectList<MyProject.Models.Enums.Education>()).HtmlAttributes(new { style = "width:100%;" })

 

Here I have dropdown with option label as first row and Enum displaynames as following but control is set to first item from enum list.

In my case I set [Required] attribute for Education in module and I expect control stays at "Please choose..." and validation is not allow to save form without choosing value. But I get control set to first value so user can simply ignore this control

Veselin Tsvetanov
Telerik team
 answered on 15 Nov 2017
1 answer
169 views

Hello Telerik Support Team (or to whom it may concern otherwise)

 

I have a boolean property bound to a Grid control column.
I would like to have a checkbox in that column that represents the boolean value of the model.
Here's a screenshot of how it currently looks (the 'Ja'/'Nein' is just a Client Template that i added temporarly, that one should be a checkbox)

Here's the screenshot:
https://i.imgur.com/ScvwCLo.png

Here's the code of the View:
https://pastebin.com/9WED8qAN

Here's the viewmodel behind the grid:
https://pastebin.com/gfY8d6dH

How can I do this?

Of course I googled around. But I only found javascript solutions that circumvented the usual asp.net core MVC logic. Plus none of the examples I found actually worked. So I'd like to know how I can do this in my particular case.

 

Thanks in advance.

And of course, if you need some more code, I can provide it on a need to know basis.

 

 

Marcel Härry
Top achievements
Rank 1
 answered on 10 Nov 2017
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?