Telerik Forums
UI for Blazor Forum
1 answer
209 views

Hi,

I'm just playing with the TelerikEditor control and I've noticed that if I type or paste some text into the editor and then delete it all, it's leaving behind some HTML.

If just typing text and deleting it, it seems to leave "<p><br></p>" in the bound value. 

When pasting in some code from stack overflow I've also seen it leave behind this: "<pre><code><br></code></pre>" - this happens when you paste part of a code block and then a combination of "delete" & "backspace" (I haven't quite figured the order of deleting to get this).

On a separate note, in an ideal world this control would be functionally similar to the other rich text editors in your suite - I'm trying to find one that behaves the same in Blazor (or the Web) and on WPF, as our application runs on different platforms.  Yours seem very different to each other.

No rush as for me as I probably won't use it anyway, but I thought I'd mention!

Kind Regards,
Nick.

 

 

Dimo
Telerik team
 answered on 18 May 2021
1 answer
779 views

I have a Telerik Blazor Grid which has selection tickboxes that allow multiple tickboxes to be selected at any one time.  I can store the selected tickbox state to hold a list of all the selected items.

If I navigate away from the grid say to another page and then return back to the grid I would like to be able to render the grid with the rows that were selected so they are shown as still ticked - is this possible?

Do you have any example code?

Thanks.

---

I have followed the pattern in here: https://github.com/telerik/blazor-ui/blob/master/grid/persist-selection/Pages/Index.razor

I am storing the SelectedItems in the SelectedItemsChanged event handler and storing them on a Cascading value component so they are available across pages.

When returning back to the page that has the grid the SelectedItems are not highlighted.

The grid's SelectedItems property points to the CascadingValue property of selected items.

I can successfully print out the SelectedItems count from the same CascadingValue property above the grid, so there is definitely data there, but the grid doesn't seem to want to show those items as selected.

I have also tried setting the SelectedItems property on SetState but that has same problem.

FYI
The grid uses OnRead where the data is filled into the grid on initialization of the page and when ever paging or filtering, sorting is applied.

---

I have taken the https://github.com/telerik/blazor-ui/blob/master/grid/persist-selection example and updated it to use a CascadingValue parameter to persist the state across pages.  This can be found here in this feature branch: https://github.com/adrianwright109/blazor-ui/tree/feature/persisted-state-not-updated-in-grid

The CascadingValue is working to persist state across pages as can be seen from the animated gif below, as the IDs 1 and 3 are shown under the grid after navigating pages.  What is not working is that those rows in the grid should also be highlighted and ticked as selected.

Animated Gif

---

I think the issue could be that the grid is not seeing the selected items that have been persisted as the same as the ones when returning back to the grid.

The data in the grid is re-populated from the database and the object references don't match. 

If I hard code the data then the persisted selection so correctly when returning back to the grid.  

Is this a bug or do I need to manually override/set Equals on the grid row objects?

If implementing manual overrides to the Equals method is required, examples of how to do this so its compatible with the grid would be appreciated.

---

Marin Bratanov
Telerik team
 answered on 17 May 2021
1 answer
350 views

I was using Ed Charbenaeau's BlazorSize, but wanted to remove the extra dependency now that similar functionality is built into UI for Blazor.

Is there an analogue to the IResizeListener/ResizeListener class? I have a base class component that's injecting IResizeListener, I didn't see a method to do that with Telerik.

Thanks!

Marin Bratanov
Telerik team
 answered on 17 May 2021
2 answers
1.2K+ views

Hi!

 

I have successfully used the editor control in my application. Now its priming time. I need guidance on sanitization as in the docs section, I only see this tip section:

The application must sanitize the content before passing it to the editor and, optionally, before saving it to its storage after obtaining it from the editor. It is up to the application to ensure there is no malicious content (such as input sanitization, XSS attack prevention and other security concerns).

 

Is there a best-practice or at least a minimum common rules to check for? Is there something you guys are using behind your online demo? I need to know because my site will be public facing and any malicious activity can get me in trouble.

Andy
Top achievements
Rank 1
Iron
 answered on 15 May 2021
1 answer
1.6K+ views

I switched Telerik to the Bootstrap theme, which at first looked good, but realized all the Telerik controls don't really seem to be using Bootstrap and are set to the default sizes. I need the small (sm) sizes which in Bootstrap is trivial to change.

Is there a better way to make all the controls smaller? I've found some controls will accept Bootstrap css while others will not making using Telerik time consuming. The best way I've found to make the Grid smaller is to make my own CSS classes and extensive use of the !important tag, but I still have a lot of work left to get the Grid sized appropriately.

Other controls are inconsistent.

For example, this works:
<TelerikTextBox ... Class="form-control form-control-sm" />


But this does not:
<TelerikNumericTextBox ... Class="form-control form-control-sm" />

Dimo
Telerik team
 answered on 14 May 2021
1 answer
861 views

I know you can autosize a column by double clicking on the column edge, but is there any way this can be done programmatically?

I would like the grid to automatically size the columns to fit there content when the grid is first displayed.

Marin Bratanov
Telerik team
 answered on 13 May 2021
1 answer
1.9K+ views

The VisibleChangedHandler is never hit, either on open or close.  Using version 2.23.0

 

My code/markup is as such:

 <TelerikWindow Visible="@documentWindowVisible" VisibleChanged="@VisibleChangedHandler">
        <WindowTitle>View/Manage Attachment</WindowTitle>
        <WindowContent>
            <div id="tooltipmanagedocument" title="View Current Document"></div>
            <TelerikEditor @bind-Value="@currentAttachment.Content"></TelerikEditor>
            <TelerikButton OnClick="@UpsertDocument" Icon="save"></TelerikButton>
            <TelerikButton OnClick="@ExportToPDF" Icon="download"></TelerikButton>
            <label>
                Upload Attachment (will overwrite existing Attachment but retain history)
                <InputFile OnChange="@LoadDocumentFromDisk" accept=".docx"/>
            </label>
        </WindowContent>
        <WindowActions>
            <WindowAction Name="Maximize"></WindowAction>
            <WindowAction OnClick="hideManageDocument" Name="Close"></WindowAction>
        </WindowActions>

    </TelerikWindow>

 

public void VisibleChangedHandler(bool currVisible)
        {
            if (currVisible)
            {
                documentWindowVisible = true;
                if (IsThereACurrentAttachment)
                {
                    LoadDocumentFromDB();
                }
                else
                {
                    // need to make load document button invisible
                }
            } 
            else
            {
                documentWindowVisible = false;
            }
        }

 

Marin Bratanov
Telerik team
 answered on 12 May 2021
1 answer
213 views

I am using the editorpastesettings:

<EditorSettings>
     <EditorPasteSettings ConvertMsLists="true"
                                           RemoveMsClasses="true"
                                           RemoveMsStyles="true"
                                           RemoveHtmlComments="true">
     </EditorPasteSettings>
</EditorSettings>

However, when I use these settings it is preventing me from pasting an image (not from a word document, just a screen grab) into the editor.

If I take out the EditorSettings, it works fine.  I'm not sure why any of these settings would (or should) prevent me from pasting an image into the editor?

Marin Bratanov
Telerik team
 answered on 12 May 2021
1 answer
218 views
Is there anyway to prepopulate the Upload control? Basically access the Files property to initialize with existing files. I am able to do this in the Kendo UI Upload. 
Marin Bratanov
Telerik team
 answered on 12 May 2021
1 answer
395 views

Hi:

Does the new Card component raise events when the cards are resized or reordered? Do they support resize/reorder? Drag & Drop?

I'm would like to determine if the Card component is a better choice than the TileLayout component as I will need to reorder, add, and delete cards/tiles based upon interaction with the user.

Thanks

marc

Marin Bratanov
Telerik team
 answered on 12 May 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?