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

Good morning,

i need to save column sorting and other filters within a grid.

The only method i figured out is this:

I save the current grid state to the browser local storage

$(window).on("beforeunload", function () { var GType = '@Model.flowCatalogId' + '@Model.flowTypeCatalogId' + '@Model.filterVersion' + '@ViewBag.Lang' + '_grid_filtered'; var grid = $("#grid_filtered").data("kendoGrid"); localStorage["QSW-grid-Claim-List" + GType] = utf8_to_b64(kendo.stringify(grid.getOptions())); })

Then i reload it every time i enter the page at the end of it's load

$(document).ready(function () {

        $('body').css('pointer-events', 'all') //activate all pointer-events on body
        $('#dialog_pos').data("kendoDialog").close();
        $('#dialog_pos_supp').data("kendoDialog").close();
        $('#dialog_create').data("kendoDialog").close();

        var GType = '@Model.flowCatalogId' + '@Model.flowTypeCatalogId' + '@Model.filterVersion' + '@ViewBag.Lang' + '_grid_filtered';
        var grid = $("#grid_filtered").data("kendoGrid");

        if (localStorage["QSW-grid-Claim-List" + GType]) {
            var options = b64_to_utf8(localStorage["QSW-grid-Claim-List" + GType]);
            grid.setOptions(JSON.parse(options));
        }
        else
        {
            for (i = 0; i < localStorage.length; i++) {
                x = localStorage.key(i);
                if (x.includes("QSW")) { localStorage.removeItem(x);}
            }
        }

        $('#btnCreate').click(function (e) {
            $(this).prop('disabled', true);
            $('#create_form').submit();
        });


    });

This works but it do the read function of my grid 2 times.

.Read(read => read.Action("Claims_Read_Filtered", "Claim", new { flowCatalogId = Model.flowCatalogId, flowTypeCatalogId = Model.flowTypeCatalogId, Model.DateFrom, Model.DateTo})
My question is, how can i save the state of the grid with all of its filters and the column sorting and all the eventual changes i've done to it without run the read a second time?
Mihaela
Telerik team
 answered on 24 Jul 2023
1 answer
156 views

Hello I have being looking for examples on  using auto complete using tag helpers  but coulnt find any 

in my grid column i have

        <column field="TechnicianAssigned" width="250" editor="categoryDropDownEditor" />

 

 and the categoryDropDownEditor has  code as below....the code hits the  url but not sure how to pass the data from column to  method and serach the functionality.Any example would be helpful.

 

   function categoryDropDownEditor(data) {
            $('<input data-bind="value: value" name="' + data.field + '"/>')
                .kendoAutoComplete({
                    dataSource: {
                        transport: {
                            read: {
                                url: "/Home/EmpSearchData",
                                dataType: "jsonp"
                            }
                        }
                    },
                    dataTextField: "ename",

                    filter: "contains",
                    minLength: 4
                });
        }
Alexander
Telerik team
 answered on 24 Jul 2023
1 answer
464 views

Hello,

I have an Ajax Kendo grid and would like to apply a filter on load.  There is a date column that I would like to get the max date and use that as the initial filter (not hardcoding the value).  Is this doable and if so how?

Thanks

D

Mihaela
Telerik team
 answered on 21 Jul 2023
0 answers
82 views
I need an editor for the field of text type. This editor when is activated should show two buttons. When the first button with the plus icon is clicked, an input appears in which a new value is typed. When the button with a colon is clicked, a dropdown appears from which an existing value is selected.
kva
Top achievements
Rank 2
Iron
Iron
Iron
 asked on 20 Jul 2023
1 answer
194 views

My template is

```

<script id="template" type="text/kendo-impl">
<div>
<partial name="EditorTemplates/WorkingEmployeeEditorTemplate"/>
<div style="margin: 15px; display: inline-block;">
@(Html.Kendo().Button()
.Name("createButton")
.Content("Add")
// .Events(e => { e.Click("create"); })
)
</div>
</div>
</script>

```

It should have the dropdown and button in one row. When I rerun the page with this template, the grid disappears.

Alexander
Telerik team
 answered on 19 Jul 2023
1 answer
773 views
I have uploaded .wav audio file using kendo upload and i have the blob path and url, that the file is saved to.
Now do we have a control that helps us play audio file that is uploaded. like we have this
https://demos.telerik.com/aspnet-core/mediaplayer/events
Stoyan
Telerik team
 answered on 19 Jul 2023
1 answer
126 views

Hello,

I'm using an internal API that has rate and size limiting and I think it would be beneficial to show the user a used character out of total characters placeholder. Something similar to this as an example.

Stoyan
Telerik team
 answered on 19 Jul 2023
1 answer
120 views

Hi,

 

using Telerik Asp Net Core version 2022.2.621

I have a problem with the UI of the Scheduler, when trying to display 15 mins events.  The widget contains typically 30 mins to 1 hour events, occasionally, there are  15 mins events, in which case after the 15 mins event the next event is pushed to the right.  How to prevent that kind of behavior without changing the Major Ticks configuration. 

Changing the Major Ticks configuration will cause a problem in the UI because normal classes are 1 hour length. 

 

Mihaela
Telerik team
 answered on 17 Jul 2023
0 answers
90 views

Question

I had a grid with EditMode of  "GridEditMode.InCell".

Users can insert multiple data by Datasource  ajax create method.

The create method works fine the first time.

However, when I tried to insert data the second time

The action recieved all of the data from view(includes the data already inserted in the first time).

How I can prevent from getting datas already inserted?

Is there any work arrounds?


@(Html.Kendo().Grid<Digitalization2.Web.Controllers.AgentOrder.CreateOrderDetailViewModel>()
                         .Name("agentordergrid")
                         .DataSource(dataSource => dataSource
                              .Ajax()
                              .PageSize(10)
                              .Batch(true)
                              .Model(model =>{
                                  model.Id(x => x.ID);
                                  model.Field(x => x.ID).Editable(false);
                                  model.Field(x => x.ProductTypeView).DefaultValue(new ProductTypeViewModel(){ ParameterValue = "SD"});
                                  model.Field(x => x.ProductModelView).DefaultValue(new ProductModelViewModel(){ProductID = 1, ProductModel = "SSD0100"});
                              })
                              .Read(read => read.Action("GetOrderDetailByOrderId", "AgentOrder", new { agentOrderId = @data.ID}))
                              .Create(create => create.Action("CreateAgentOrderDetail", "AgentOrder"))
                              .Destroy(destroy => destroy.Action("DeleteAgentOrdetDetails", "AgentOrder"))
                          )
                         .Columns(col => {
                             col.Bound(x => x.ProductTypeView).Width(150).ClientTemplate("#=ProductTypeView.ParameterValue#");
                             col.Bound(x => x.ProductModelView).Width(250).ClientTemplate("#=ProductModelView.ProductModel#");
                             col.Bound(x => x.ItemCount).Width(75);
                             col.Bound(x => x.UnitPrice).Width(150);
                             col.Bound(x => x.Remark).Width(500);
                             col.Command(command => command.Destroy()).Width(75);
                         })
                         .ToolBar(toolbar => 
                         {
                             toolbar.Create();
                             toolbar.Save().;
                         })
                         .Editable(editable => editable.Mode(GridEditMode.InCell))
                    )

CHIHPEI
Top achievements
Rank 2
Iron
Iron
Iron
 updated question on 17 Jul 2023
1 answer
785 views

I have a datepicker databound to a model as follows:

  <div class="col-sm-3">
            <label asp-for="ADR.Date" class="form-label"></label>
            <kendo-datepicker for="ADR.Date" class="form-control"></kendo-datepicker>
            <span asp-validation-for="ADR.Date" class="text-danger"></span>
   </div>

The ADR model property does not allow nulls:

[DataType(DataType.Date)]
public DateTime Date { get; set; }

This is for good reason, I want to prevent the user from omitting the date when they fill out the form and for the data validation to fire correctly.

However instead of being empty when the form is first opened, the Datepicker fills the date with 01/01/1901, which is unwanted behavior as the user then doesn't enter a correct date.

How do we ensure the datepicker is empty when first loading the form and the calendar is on todays date when empty?

 

Stoyan
Telerik team
 answered on 12 Jul 2023
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?