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

How can you set the default Zoom Level on the PDF Viewer?  It defaults to "Automatic Width" but I want it to default to "Fit to Width".


    <kendo-pdfviewer name="pdfviewer">
        <pdfjs-processing file="@(Url.Action("GetReportDownload", "Downloader"))"/>
        <toolbar enabled="true">
        </toolbar>
    </kendo-pdfviewer>

 

Stefan
Top achievements
Rank 1
Iron
 answered on 14 Sep 2023
3 answers
249 views

Hello,

im using kendo-react with .net core integration.

When i want to filter a Grid the query generated by the method: `toDataSourceRequest()`use the sql function LOWER to compare a string column.

With this behaviour its impossible to match only the exact rows. I want to disable this function and use the `=` operator in SQL.


I think if i use: `ignoreCase: false` in the frontend and then serialize with: `toDataSourceRequestString` from the `@progress/kendo-data-query` package, the `DataSourceRequest` will contain the ignoreCase prop and the toDataSourceRequest will do the job.

But the ignoreCase:false prop is not added to the query param,.

Any suggestion? Its not possible to use ignoreCase with the backend integration and only works in frontend?

https://codesandbox.io/s/vigorous-bush-s2fgnc => ignore case working when the filter is in frontend.

- https://codesandbox.io/s/nervous-platform-9nr2q4 => with backend not working

Thanks!

Carlos
Top achievements
Rank 2
Iron
Iron
Iron
 updated answer on 12 Sep 2023
1 answer
145 views

When updating a record in the grid - it does not allow me to save an empty string for that field - if the previous value in the field contained a value.

My underlying class property doesn't work with either of the following options

with annotations:     

[Display(Name = "Comments")]
[Required(AllowEmptyStrings = true)]
public string ItemComments { get; set; } = " ";

Without annotations:

public string ItemComments { get; set; } = " ";
Mihaela
Telerik team
 answered on 12 Sep 2023
1 answer
140 views

I have grid and form, which are bound to Employee object. It has object property Department. To edit it, I use separate editors, because I didn't find the right format to allow editing in both places.

Usage in form:

i.Add().Field(e => e.DepartmentId).Label("Отдел").EditorTemplateView(Html.Partial("FormEditors/Department"));

Editor of the form's field:

@(Html.Kendo().DropDownList()
    .Name("DepartmentId")
    .DataTextField("Name")
    .DataValueField("Id")
    .Filter(FilterType.Contains)
    .DataSource(source =>
    {
        source.Read(read => read.Action("GetDepartments", "Home"));
    }))

Usage in grid:

        columns.Bound(p => p.Department.Name).Width(230)
            .ClientTemplate("#=data.Department?.Name ?? ''#")
            .EditorTemplateName("Department")
            .Filterable(ftb => ftb.Cell(cell =>
            {
                cell.Operator("startswith");
                cell.ShowOperators(false);
            }));

Editor of the grid's column:

@(Html.Kendo().DropDownListFor(m => m)
    .DataTextField("Name")
    .DataValueField("Id")
    .Filter(FilterType.Contains)
    .HtmlAttributes(new { data_bind = "value: Department" })
    .DataSource(source =>
    {
        source.Read(read =>
        {
            read.Action("GetDepartments", "Home");
        });
    }))


Mihaela
Telerik team
 answered on 12 Sep 2023
1 answer
160 views

Hi there,

While working with the Filter Component I was able to export an CompositeFilterDescriptor object on the client side before sending it to the server, the backend is a .net core API.

Unfortunately I tried to use Telerik.Datasource DLL in order to utilize the JSON parsing functionality inside however it seems like they are from two different worlds !

On the Angular side the CompositeFilterDescriptor looks like this 

{
    "logic": "or", 
    "filters": [ 
       {
           "field" : "unitId",
           "operator" : "eq", 
            "value" : "1005"
       }
     ]
}

On the .NET side the CompositeFilterDescriptor it is expecting something like this


{
  "logicalOperator": 1,
  "filterDescriptors": [
      {
        "member": "unitId", 
        "operator": 2 , 
        "value" : "1005"
      }
  ]
}

Summary of Differences

1- Field names are different and hence not parsed properly ( i.e. logicalOperator vs logic, member vs field)

2- Enumerations are sent as strings from Angular but parsed as Integers from Telerik.Datasource 

 

I feel a little bit confused here, is there any library provided by Telerik that I can use to capture the Angular CompositeFilterDescriptor JSON Object received from the client app inside a Web API ?


 

Alexander
Telerik team
 answered on 08 Sep 2023
1 answer
87 views

I use a DropDownList as an EditorTemplate in a Grid.

The problem is, that the DDL has to display several thousand entries (products).

I tried to set the PageSize of the DataSource and handle the Filter-Event. This works fine so far.  The DDL opens very fast and I can search (filter) and then select an entry, that is not visible in the list at the beginning.

This works fine for adding a new record.

But when I want to edit an existing record in the grid I get problems. When the editor opens and the value is not in the select list of the DDL, it is not selected (also not displayed) and the value of the DDL is set to null.

This behavior makes sense to me.

When I remove the PageSize from the DataSource everythings works fine. But it takes to long to open the DDL. That's why I need another solution.

I also tried the virtualization. But the problem stays the same.

Does anyone have an idea how I can solve this?

Maybe another control? Finally the user should be able to search and select a product on an easy way.

I am grateful for any idea.

CPS
Top achievements
Rank 1
Iron
Iron
 answered on 06 Sep 2023
1 answer
77 views
I have the following breadcrumb:
    @(Html.Kendo().Breadcrumb()
        .Name("breadcrumb")
        .BindToLocation(true)
        .Navigational(true))
When I go to route /Directory/Users/Managers it will show entries: Directory, Users, Managers. Is there a way to localize them to my language?
Vasko
Telerik team
 answered on 05 Sep 2023
1 answer
175 views

I have a grid which is a part of bigger form. I want to be able to do all sorts of data manipulation without saving it immediately. When saving form, I need to save data in a grid.

I'm experiencing a problem when editing a row in InLine mode. When I click on "edit", then "cancel", the row disappears from the grid depending on how I load data into the grid.

If Read method looks like this, than canceling edit works good but I'm not able to save data temporarily.

public JsonResult OnPostRead([DataSourceRequest] DataSourceRequest request)
        {
            ToDestinations = _entities.ToDestinations.ToList();
            //var data = HttpContext.Session.Get("ToDestinationsData");
            //if (data != null)
            //{
            //    ToDestinations = JsonConvert.DeserializeObject<List<ToDestination>>(Encoding.UTF8.GetString(data));
            //}

            return new JsonResult(ToDestinations.ToDataSourceResult(request));
        }

On the other hand, if Read method looks like below, every row that I'm doing "edit" => "cancel" disappears. (This was a start to making grid data persistent while doing all kinds of data manipulation in a grid.)

public JsonResult OnPostRead([DataSourceRequest] DataSourceRequest request)
        {
            //ToDestinations = _entities.ToDestinations.ToList();
            var data = HttpContext.Session.Get("ToDestinationsData");
            if (data != null)
            {
                ToDestinations = JsonConvert.DeserializeObject<List<ToDestination>>(Encoding.UTF8.GetString(data));
            }

            return new JsonResult(ToDestinations.ToDataSourceResult(request));
        }

This is my grid.

@(Html.Kendo().Grid<ToDestination>()
            .Name("grid")
            .Columns(columns =>
            {
                columns.ForeignKey(c => c.TravelTypeId, ds => ds.Read(read => read.Url(Url.Page("Create", "TravelTypes"))), "TravelTypeId", "TravelTypeName").Title("Vrsta putovanja");

                columns.ForeignKey(c => c.CountryId, ds => ds.Read(read => read.Url(Url.Page("Create", "Countries"))), "CountryId", "CountryName", true).Title("Država")
                .EditorTemplateName("CountryEditor"); // Specify a custom editor template for the Country dropdown.

                columns.ForeignKey(c => c.PlaceId, ds => ds.Read(read => read.Url(Url.Page("Create", "Places"))), "PlaceId", "PlaceName", true).Title("Mjesto")
                .EditorTemplateName("PlaceEditor"); // Specify a custom editor template for the Place dropdown.

                columns.ForeignKey(c => c.CenterId, ds => ds.Read(read => read.Url(Url.Page("Create", "Centers"))), "CenterId", "CenterName", true).Title("Centar")
                .EditorTemplateName("CenterEditor"); // Specify a custom editor template for the Center dropdown.

                columns.Command(command => { command.Edit(); command.Destroy(); }).Width(250);
            })
            .ToolBar(toolbar => toolbar.Create())
            .Editable(editable => editable.Mode(GridEditMode.InLine))
            .Pageable()
            .Sortable()
            .Scrollable()
            .DataSource(ds => ds.Ajax()
            .Create(c => c.Url("/TravelOrders/Create?handler=Create").Data("forgeryToken"))
            .Read(r => r.Url("/TravelOrders/Create?handler=Read").Data("forgeryToken"))
            .Update(u => u.Url("/TravelOrders/Create?handler=Update").Data("forgeryToken"))
            .Destroy(d => d.Url("/TravelOrders/Create?handler=Destroy").Data("forgeryToken"))
            .Model(m =>
            {
                m.Id(id => id.ToDestinationId);
            })
            ))

I hope what I wrote makes sense.

What is the best practice to achieve saving grid data temporarily without "edit" => "cancel" bug appearing?

Stoyan
Telerik team
 answered on 04 Sep 2023
1 answer
147 views
 

Hello,

after upgrading the versions buttons will not shown correctly

  • Edit Button is disabled
  • Delete Button will not shown anymore

We using dotnet core version 7 and Telerik version 2023.2.606:

Here is the code of the columns.

                      <column html-attributes="@(new Dictionary<string, object>{{"class", "ActionEdit"}})" header-html-attributes="@(new Dictionary<string, object> { { "class", "ActionEdit" } })" title=@Model._htmlLocalizer.GetHtmlTextForKey(" ", @Model.UserNumber)>
                            <commands>
                                <column-command template="<a class='k-grid-edit k-icon k-i-edit button_icon' href='\#'> </a>" text="\{Edit\}" icon-class="k-icon k-i-edit button_icon" name="edit"></column-command>
                            </commands>
                        </column>
                        <column html-attributes="@(new Dictionary<string, object>{{"class", "ActionDelete"}})" header-html-attributes="@(new Dictionary<string, object> { { "class", "ActionDelete" } })" title=@Model._htmlLocalizer.GetHtmlTextForKey(" ", @Model.UserNumber)>
                            <commands>
                                <column-command text=" " icon-class="k-icon k-i-delete button_icon" name="custom" click="deleteContractCondition"></column-command>
                            </commands>
                        </column>

Have you any idea to fix the problems? I think the icon class is changed with the update.

Second problem is to disable the buttons via javascript:

                $(".k-grid-edit").addClass("k-state-disabled")
                $(".k-grid-custom").addClass("k-state-disabled")

Before the update this commands works well after not. Have you any idea to find the icon via javascript.

Best regards
Jens

Jens
Top achievements
Rank 1
Iron
 answered on 29 Aug 2023
1 answer
86 views

Hi, I have the following graph:

I would like to keep the values in the left side but without showing the negative sign, because they represent quantities. I tried several things for formatting the ValueAxis in order to perform some sort of Math.abs operation but nothing works. Is it possible what I want to achieve?

Otherwise, I wouldn't mid not showing the value axis if I can show the absolutes quantities using label template. However, I get a lot of undefined values that I don't know how to remove:

 .Series(series =>
            {

            series.Bar(
                model => model.Quantity,
                categoryExpression: model => model.Price
            ).Labels(l => l.Visible(true).Template("#= customLabelFormat(value) #").Position(ChartBarLabelsPosition.OutsideEnd).Color("#RGBA"));
        })

 

 

 function customLabelFormat(value) {
           
             return Math.abs(value).toString();
 
        }

 

Thanks a lot.

 

Alexander
Telerik team
 answered on 29 Aug 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Anislav
Top achievements
Rank 6
Silver
Bronze
Bronze
Jianxian
Top achievements
Rank 1
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Jim
Top achievements
Rank 2
Iron
Iron
Nurik
Top achievements
Rank 2
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?