Telerik Forums
UI for ASP.NET Core Forum
3 answers
1.2K+ views

Hello,

I have the following grid with columns.AutoGenerate(true) :

@(Html.Kendo().Grid<dynamic>()
      .Name("gridEQ")
      .Columns(columns =>
      {
          columns.AutoGenerate(true);
      })
      .Pageable()
      .Sortable()
      .Scrollable()
      .Selectable(s => s.Mode(GridSelectionMode.Multiple))
      .NoRecords()
      .Filterable(f => f.Enabled(false))
      .AutoBind(false)
      .DataSource(dataSource => dataSource
          .Ajax()
          .PageSize(100)
          .Read(read => read.Action("Read", "Home"))
      )
    )

 

If there is a query result from SQLServer with a column Name with spaces no rows are shown in the grid (the column Header is there)
see attached Picture

here is the json result:

{"Data":[{"Anzahl der Betriebsmittel":1376}],"Total":1,"AggregateResults":null,"Errors":null}
Viktor Tachev
Telerik team
 answered on 24 Nov 2017
1 answer
101 views

Hi - I'm trying to filter a grid that is bound to child tables using .Include() and .IncludeNext() and having no luck. I keep getting the error below - any help would be appreciated, I tried just about everything including gathering up all the SerialNumbers at a higher level but that was flakey code and causing a performance degradation.

Message"Invalid property or field - 'SerialNumber' for type: Invoice"string

Here's my data load statement:

invoices = from inv in _context.Invoices.Include(i => i.ShippingAddress).Include(i => i.InvoiceLines).ThenInclude(s => s.SerialNumbers)    
                       where orgIds.Contains(inv.OwnedBy_Id) select inv;

And my filters:

$("#Grid").data("kendoGrid").dataSource.filter({
            logic: "or",
            filters: [
                {
                    field: "SerialNumber",
                    operator: "contains",
                    value: searchValue
                },

Thanks!
Craig

Konstantin Dikov
Telerik team
 answered on 24 Nov 2017
1 answer
264 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
652 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
126 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
305 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
246 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
194 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
244 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
191 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?