Telerik Forums
UI for Blazor Forum
2 answers
142 views

Hello,

When I add the tag Filterable="true" to my DropDownList I get the following exception when I try to click on the dropdown:

" Could not find 'TelerikBlazor.initDropDownListFilter' ('initDropDownListFilter' was undefined)."

The project build without a problem but the error occurs when I click the dropdown. Am I missing a using statement or what could be the problem?

Simon
Top achievements
Rank 1
Iron
 updated answer on 15 Jun 2021
1 answer
916 views

Hello!
It is possible to hide or reduce width for grid's hierarchy cells?

On mobile devices, this place is very valuable and is not used effectively.

When setting the value of a class property
.k-hierarchy-cell { display = none }
the nested table does not fill the full width of the container

 

Dimo
Telerik team
 answered on 15 Jun 2021
1 answer
422 views
We have have built a multiselect into a window component that can be pop-up on the host page. We have a few instances where we only want the user to be able to select one item and we would like to pass a parm into our component to limit the multiselect to one item. Is that possible?
Marin Bratanov
Telerik team
 answered on 14 Jun 2021
1 answer
2.0K+ views
Hello!
I am trying to use a Window component as a dialog with awaiting the result of an action.
Until the user presses the confirm or cancel button, the calling code must wait for an action.
In a Dialog component (not a Window component) this is implemented as:
var result = await dialog.Show().Result;
My implemetation for Window component (component have two buttons with OnClick="@Submit(true or false)"):

bool isVisible, dialogResult; CancellationTokenSource tokenSource; public async Task<bool> Show() { isVisible = true;
  await InvokeAsync(StateHasChanged); return await Task.Run(WaitForResult); }
// Waiting for action

private async Task<bool> WaitForResult() {

tokenSource = new();
while
(!tokenSource.Token.IsCancellationRequested) ;

isVisible = false;
 await InvokeAsync(StateHasChanged);

return dialogResult; } private async void Submit(bool result) { dialogResult = result; tokenSource.Cancel(); }


This works, but WaitForResult method is overloading processor.
PLEASE help me with correct impementation...
Marin Bratanov
Telerik team
 answered on 14 Jun 2021
1 answer
1.4K+ views

The Telerik Blazor Grid documentation on column widths mentions that:

To allow the users to auto-fit the column widths to the content, enable column resizing - a double click on the border between the headers will have the grid adjust the column width according to the size of the data, headers and footers content.

Is it possible to generate the grid so that all the columns are set to auto-fit the data by default, rather than it being something that the user has to trigger themselves?

Dimo
Telerik team
 answered on 14 Jun 2021
1 answer
502 views

I have a Telerik Blazor Grid where I have implemented a custom FilterMenuTemplate which is used on 12 of the columns in the grid.

The custom FilterMenuTemplate displays a checkbox for all the distinct values in the database for that column field.

It takes approximately 2-3 seconds for the data to be returned from the database, and this is for each column.

When I first implemented the custom FilterMenuTemplate I only added it to a single column and it worked fine.  Since adding it to all 12 columns I have experienced a null reference exception.  The exception happens when the data hasn't finished being returned from the database and the collection Data property in the custom FilterMenuTemplate is null.

I added a null check like so to stop the null reference exception from being thrown, instead displaying a message to the user that the data is loading...:

<div class="filter-values-container">
    @if (Data == null)
    {
        <p>Loading filter values...</p>
    }
    else
    {
        foreach (var item in Data)
        {
            <div>
                <TelerikCheckBox Value="@(CurrentDistinctValueFilters.Contains(item.Key.ToString()))"
                                 ValueChanged="@((bool value) => CheckBoxValueChanged(value, item.Key.ToString()))"
                                 Id="@($"{Field}_{item.Key}")"
                                 Enabled="@EnableDistinctValues"/>
                <label for="@($"{Field}_{item.Key}")" class="k-label k-form-label">
                    @item.Value
                </label>
            </div>
        }
    }
</div>

What I was hoping would happen is that once the user clicks on the column filter, that the filter popup would temporarily show the loading message and then dynamically update and remove the loading message instead show the checkboxes once the Data property had data from the database.

This doesn't appear to happen, instead the filter popup remains open and the loading message stays on screen.  In order to get the filter popup to update with the checkboxes the user has to cancel the filter popup and re-active it to show the data.

Is there away of updating the filter popup dynamically once it is open and the data is available to render the checkboxes?

As a temporary crud workaround what I have none for now is disabled all the columns with these particular custom filters by binding the Filterable property on those columns to a boolean property which gets set to true when ALL the data for ALL 12 of those columns have been retrieved from the database.

e.g.

Filterable="@DataLoadedForGridFilters"

The downside to this is that none of those 12 column filters are enabled to be used for about 25+ seconds after the grid and then the associated column filter data have been retrieved from the database.

 

Dimo
Telerik team
 answered on 14 Jun 2021
1 answer
191 views

I need to return separate variables for the selected values (which will be used to query the data) and selected Text that will be use to populate a textbox on the page to show the user what they selected. I have a multiselect embedded within a Telerik Window so it pops-up, they select items and press the select button I have and the pop-up is hidden. it's returning the selected values but how do I also bind to the selected text?

 

 

David
Top achievements
Rank 1
Iron
Iron
Iron
 answered on 11 Jun 2021
2 answers
432 views

Hi,

I have some measurement date in a database table:

...
        public int Number { get; set; }
        public DateTime Start { get; set; }
        public long ElapsedTime { get; set; }
...

I want make a view similar in the attached image with expandable rows group by the date.

In the Viewmodel I add a property to get the Date from Start to support GROUP BY Date:

public IQueryable<MeasurementViewModel> GetMeasurements()
        {
            var result = _context.Measurement.Select(w => new MeasurementViewModel
            {
                Date = w.Start.Date,
                Start = w.Start,
                Number = w.Number,
                ElapsedTime = w.ElapsedTime,
            }); ;
            return result;
        }

What is better to use: Grid with Grouping and aggregat or TreeList?

For TreeList I dont have parentID and childID. I think it is possible to calculate it.

The standard Grid group example doesn't work: if I drag the Date column to the header only the waiting spinner is shown.

A solution for the grid should be: without Text "Drag a column header..." and not changeable by user.

The expandable date-header-rows sould show some aggregates per day: Count()  and SUM(ElapsedTime).

Is that possible?

Best regards,

Peter

 

Peter
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 11 Jun 2021
1 answer
201 views

Does the GridReadEventArgs support some sort of in functionality?

I am trying to programmatically use several multiselect lists to create the initial query for loading data into a grid via an OData datasource.

The "query" created is close but the fieldname is surrounded by single quotes so the query does not work

This is what is created

filter=(contains('abc,DEF','MyColName'))

but this is the proper syntax

filter=(contains('abc,DEF', MyColName))

Is there anyway short of manipulating the resulting query string to remove the single  quotes from around 'MyColName'?

Or IsContainedIn now supported in the latest version of the Blazor UI library?

Nadezhda Tacheva
Telerik team
 answered on 11 Jun 2021
1 answer
1.1K+ views

When you enable filtering on grid columns the default out of the box implementation gives you 2 textboxes with an "AND" operator between the 2 textboxes.  For numeric columns a dropdown with options like "is less than or equal to", "is greater than or equal to" etc is displayed.  For string columns a dropdown with "contains" etc is displayed.

I would like to utilise the default filter implementation as described above but with the addition of my own custom checkbox filter above that will render all possible distinct values from the database.

Is there a Telerik component (similar to the TelerikCheckBoxListFilter component) that I can add to my custom FilterMenuTemplate component that will bring back the default out of the box filter UI for numbers and strings or if I'm implementing my own custom FilterMenuTemplate do I also have to manually re-create these standard filters?

Hristian Stefanov
Telerik team
 answered on 10 Jun 2021
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?