Telerik Forums
UI for ASP.NET Core Forum
2 answers
109 views

Hello,

i am using mvc returning the Json result as list . In the view using the data source reading action controller name and returning the list 

var result = context.table.sekect(m=>new

{
m.number 

}

return view(result.ToList());

 

.datatextfield(“Number”)

.datavaluefield(“Number”)

 

getting undefined in dropdown.

i have tried the json result as well in another method same results.

 

Do I need to add anything in the startup?

Thank you 

SB

 

 

Neli
Telerik team
 answered on 11 Jun 2020
3 answers
141 views

Suppose I have a MultiColumnComboBox like below.  How can I have like 10 columns in it but hide specific ones of them?  I need the data from the additional columns when the user makes a selection but, I don't want them to show.  So in the example below, how could I hide the ID, and Inst columns?  I think it would be done in the dataBound event but no idea how to do it.

--Rich

 

@(Html.Kendo().MultiColumnComboBox()
    .Name("MainSched")
    .DataTextField("Room")
    .DataValueField("Room")
    .Columns(columns =>
    {
        columns.Add().Field("ID").Title("ID").Width("100px;");
        columns.Add().Field("Room").Title("Room").Width("100px;");
        columns.Add().Field("Inst").Title("Inst").Width("100px;");
        columns.Add().Field("MKey").Title("MKey").Width("100px");
    })
    .HtmlAttributes(new { @class = "FontSmall" })
    .Height(400)
    .DataSource(source => source
    .Custom()
    .Transport(transport => transport
        .Read(read =>
        {
            read.Action("MainSched_Read", "Home");
        })))
    .Events(events => events.Change("MainSched_Change").DataBound("MainSchedDataBound"))
    )

Ivan Danchev
Telerik team
 answered on 10 Jun 2020
1 answer
909 views

Hi,

I would like to get Telerik feedback on the best way to override the delete grid function.

We are using a grid with inline editing but on the delete we need to capture extra data.

We are are doing right now:

  1. Listening for the on remove event
  2. event prevent default
  3. launch a dialog to capture extra data
  4. user confirm or not
  5. if user confirm we delete
  6. if user cancel we cancel

Everything is working good but I would like to get recommandation on how to prevent the row to disapear from the frontend ONLY WHEN the user confirm.

 

Right now as soon the delete command is clicked and we reach the on remove the row is already removed from the frontend.

 

here is code samples we have

the grid with the onremove

 

<kendo-grid name="plancodegroupgrid" height="600" navigatable="true" selectable="" on-data-bound="dataBound" on-remove="onremove">
    <datasource type="DataSourceTagHelperType.Ajax" server-filtering="true" server-paging="true" page-size="100" on-request-end="onrequestend">
        <transport>
            <read url="planCodeGroup/PlanCodeGroup_Read" />
            <update url="planCodeGroup/PlanCodeGroup_Update" />
        </transport>
        <schema>
            <model id="PlanCodeGroupID">
                <fields>
                    <field name="PlanCode" editable="false"></field>
                    <field name="RateScaleCode" editable="false"></field>
                    <field name="PolicyTypeCode" editable="false"></field>
                    <field name="RiskIntegrityGroupPrefixCode"></field>
                    <field name="SystemName" editable="false"></field>
                    <field name="StartDate" editable="false" type="date"></field>
                    <field name="EndDate" type="date"></field>
                </fields>
            </model>
        </schema>
    </datasource>
    <messages>
        <commands edit=" " update=" " canceledit=" " destroy=" " create=" "/>
    </messages>
    <sortable enabled="true" mode="multiple" show-indexes="true" />
    <filterable enabled="true" mode="row" />
    <editable mode="inline" confirmation="false" />
    <columns>
        <column field="PlanCode" title="@localizer["PlanCode"].Value">
            <filterable>
                <cell show-operators="false"></cell>
            </filterable>
        </column>
        <column width="150" field="RateScaleCode" title="@localizer["RateScale"].Value">
            <filterable>
                <cell show-operators="false"></cell>
            </filterable>
        </column>
        <column width="150" field="PolicyTypeCode" title="@localizer["PolicyType"].Value">
            <filterable>
                <cell show-operators="false"></cell>
            </filterable>
        </column>
        <column width="150" field="SystemName" title="@localizer["System"].Value">
            <filterable>
                <cell show-operators="false"></cell>
            </filterable>
        </column>
        <column field="RiskIntegrityGroupPrefixCode" editor="riskIntegrityGroupPrefixCodeEditor" title="@localizer["GroupPrefix"].Value">
            <filterable>
                <cell show-operators="false"></cell>
            </filterable>
        </column>
        <column field="StartDate" title="@localizer["Start Date"].Value" format="{0:MM/dd/yyyy}">
            <filterable>
                <cell show-operators="false"></cell>
            </filterable>
        </column>
        <column field="EndDate" title="@localizer["EndDate"].Value" format="{0:MM/dd/yyyy}">
            <filterable>
                <cell show-operators="false"></cell>
            </filterable>
        </column>
        <column width="100">
            <commands>
                <column-command name="edit"></column-command>
                <column-command name="destroy"></column-command>
            </commands>
        </column>
    </columns>
    <scrollable height="auto" virtual="true" enabled="true" />
</kendo-grid>

 

 

The onremove js  stopping the event and launching how dialog

function onremove(e) {
    e.preventDefault();
    $('#reason').val('');
    $('#dialog').data('kendoDialog').open();
    model = $('#plancodegroupgrid')
        .data('kendoGrid')
        .dataSource.get(e.model.PlanCodeGroupID);
};

 

if user cancel that s what we have (the row is re showing) 

function cancelDeletePlanGroup(e) {
    if (!confirmed) {
        $("#plancodegroupgrid").data("kendoGrid").cancelChanges();
    } else {
        confirmed = false;
    }
}

 

I tried the setup an onclick event on the delete command

But somehow the function is never called

<column width="100">
    <commands>
        <column-command name="edit"></column-command>
        <column-command name="destroy" click="onremove"></column-command>
    </commands>
</column>

The grid is capable of because when i setup the built in confirmation dialog on the row is staying in the UI until a choice is made.

other option would be to build my own delete button but I want to ask you guys before moving forward.

Let me know what is your recommended to proceed with all that logic being the exact same but without row getting away while user is making his choice.

 

Cheers

Veselin Tsvetanov
Telerik team
 answered on 10 Jun 2020
1 answer
41 views

Is this intended behaviour or a bug ?

In the Scheduler demo on your site (https://demos.telerik.com/aspnet-core/scheduler/index)

Screenshot 1

Add a recurring daily event that starts in the past sometime. My example: yesterday. 

 

Screenshot 2

Change one of the items in the past, so there is a recurrence exception for that day. My example: yesterday.

Then drag drop one of the events (on a future date) so it starts later in the day.  My example: tomorrow.
When the option comes up choose "Edit the series".

Screenshot 3
It then wipes out the previous events so in my example I have lost today and yesterday.

I assume that it is updating the start date of the event and emptying the recurrence rule, which is why this is happening, however it doesn't seem right to me.

I just want to change the event to start later for the whole series, I don't expect it to change the start date and remove recurrence exceptions.

 

Thank you.


Veselin Tsvetanov
Telerik team
 answered on 10 Jun 2020
3 answers
1.3K+ views

Hi,

I have a sub-grid where only a few columns are editable (InCell/batch mode).

I'm trying to display and update aggregate values for a calculated field/column.

I have tried 2 approaches, but got stuck with both:

1) Using the ViewModel

I have added calculated field to my ViewModel class

public int Quantity { get; set; }
public decimal UnitCost { get; set; }
public decimal TotalAmount
{
    get { return (decimal) Quantity * UnitCost; }
}

This does allow me to define an aggregate value for TotalAmount in the DataSource section, and that displays correctly initially.

But if I modify Quantity or UnitCost (both editable columns in the grid, using InCell editing), the value of TotalCost doesn't get updated accordingly. 

Can I force a refresh of the contents of the row and the aggregate values (e.g. in onSave() function?) *without* saving the edits, and if so: how?

 

2) Using a calculated column

Following the instructions of your colleague in this post: 

https://www.telerik.com/forums/asp-net-kendo-ui-grid-calculated-column

... I defined a Template-type column with calculated values.

function calculateField(data) {
    var totalCost = data.Quantity * data.UnitCost;
    return totalCost;
}

But that value doesn't get updated either when I change the values of Quantity or UnitCost.

Furthermore, I don't know if it's possible to define/display aggregate values for a column of type Template?

Appreciate your help,

Erik

Anton Mironov
Telerik team
 answered on 09 Jun 2020
1 answer
149 views

As a result a "select group by" statement, i got a resultset that looks like image in Data.jpg

Can i get a visualisation of query result similar in attached image Chart.jpg using donut chart?

Silviya Stoyanova
Telerik team
 answered on 09 Jun 2020
3 answers
130 views

Hello,

when i user colorField and user group in DataSource the color result is different  like image i attached

you can see here

https://dojo.telerik.com/aBOWINak

    group: {
                field: "symbol"
            },


            sort: {
                field: "date",
                dir: "asc"
            },

            schema: {
                model: {
                    fields: {
                        date: {
                            type: "date"
                        }
                    }
                }
            }
        });

        function createChart() {
            $("#chart").kendoChart({
                title: { text: "Stock Prices" },
                dataSource: stocksDataSource,
                series: [{
                    type: "column",
                    field: "close",
                    categoryField: "date",
                    name: "#= group.value # (close)",
                    colorField:"color"
                }],
                legend: {
                    position: "bottom"
                },

 

Amr
Top achievements
Rank 1
 answered on 08 Jun 2020
1 answer
387 views

     Hi

I am looking at the scheduler: https://demos.telerik.com/aspnet-core/scheduler/index and I am wondering when you double click in a day box (on the month view) a "event" dialog comes up. 

How does the start/end get populated. I understand if I click June 3rd box it will populate it with that date. I am guessing it is using the "DateTimePicker" but I am not sure how the correlation works.

I am after not having the "all day" even being checked and I would like to set a default time to the picker.

 

 

 

Ivan Danchev
Telerik team
 answered on 08 Jun 2020
1 answer
319 views

Hi all,

I don't know how to use template with the popup edit mode and the tag helpers.

I did not found any help in the documentation.

Is it possible ?

<kendo-grid>

    <editable mode="popup" template="???" />

</kendo-grid>

Veselin Tsvetanov
Telerik team
 answered on 08 Jun 2020
2 answers
2.1K+ views

Hi All,

 

I Have a page with  two different grids. A Parent grid and a child grid. Through JS i use the change event of the grid to refresh the datasource of the second grid (to view the child entries). I only want one row at a time to be selected. First i used the single selection mode, but i was not able to clear the selection bu clicking somewhere else in (whitespace of the the grid) or on that row again. SO i moved to checkbox selection. THis works like a charm (also un-selecting), but it allows for multiple rows to be selected. Is there any way (built in or (js) hack) to do this?

 

My grid:

                @(Html.Kendo().Grid<PortSupervisor.ViewModels.Worklist.BookingsViewModel>()
        .Name("Bookingsgrid")
        .Sortable()
        .Editable(editable => editable.Mode(GridEditMode.PopUp).TemplateName("BookingsEditor").Window(w=>w.Title("Insert/edit booking")))
        .Scrollable()
        .Selectable(s=>s.Mode(GridSelectionMode.Single))
        .Events(events =>
        {
            events.Change("onBookingsgridChange");
            events.Save("onSave");
        })
        .ToolBar(x =>
        {
            x.Create().Text("Add new Booking");
        })
        .Columns(columns =>
        {
            columns.Select().Width("2rem").ClientHeaderTemplate(" ");
            columns.Bound(c => c.ContainerNumber);
            columns.Bound(c => c.BookingReferenceOperator).Title("Ref. Operator");
            columns.Command(column =>
            {
                column
                    .Edit()
                    .Text(" ")
                    .IconClass("fa fa-edit")
                    .UpdateText("Save")
                    .UpdateIconClass(" ")
                    .CancelText("Cancel")
                    .CancelIconClass(" ")
                    .HtmlAttributes(new { data_tippy_content = "Edit" });
                column.Destroy().IconClass("fa fa-trash").Text(" ").HtmlAttributes(new { data_tippy_content = "Delete" });
            });
        })
        .DataSource(ds => ds.Ajax()
            .Events(events => events.Error("function(args){telerikGridErrorhandler(args,'Bookingsgrid');}"))
            .Read(r => r.Url("/Worklist/Journey/Bookingsgrid?handler=Read").Data("JourneyIdTokenAndVars"))
            .Update(u => u.Url("/Worklist/Journey/Bookingsgrid?handler=Update").Data("JourneyIdTokenAndVars"))
            .Create(c => c.Url("/Worklist/Journey/Bookingsgrid?handler=Create").Data("JourneyIdTokenAndVars"))
            .Destroy(d => d.Url("/Worklist/Journey/Bookingsgrid?handler=Destroy").Data("JourneyIdTokenAndVars"))
            .Model(m => {
                m.Id(field => field.BookingId);
                m.Field(field => field.BookingId).Editable(false);
            })
            .PageSize(5)
        )
        .Pageable()
        .Height("29rem")
    )

Alexander
Top achievements
Rank 1
Veteran
Iron
 answered on 08 Jun 2020
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?