Skip to content

kb(Gantt): add Gantt TreeList width persistance kb #3061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

IvanDanchev
Copy link
Contributor

Note to external contributors: make sure to sign our Contribution License Agreement (CLA) for Blazor UI first:

https://forms.office.com/Pages/ResponsePage.aspx?id=Z2om2-DLJk2uGtBYH-A1NbWxVqugKN5DvVp8I-1AgOBURFBVSkwyMlA1TkFDVFdMNU1aM1o1UlZQOC4u

@IvanDanchev IvanDanchev requested a review from a team as a code owner June 23, 2025 13:49
@IvanDanchev IvanDanchev added the merge-to-production Use this label to get a comment to choose whether to merge the PR to production label Jun 23, 2025
Copy link
Contributor

Hello @IvanDanchev,

Check the below option if you would like to automatically generate PR to production. The automation uses the branch for the cherry-pick, and then will delete the branch. Please, do not delete it manually.

  • create PR to production

@IvanDanchev IvanDanchev requested a review from a team June 23, 2025 13:49
type: how-to
page_title: How to Display Model Fields in the Gantt Tooltip?
slug: gantt-kb-persist-treelist-width-after-refresh
tags: gantt, blazor, treelist, width, persist
Copy link
Contributor

@dimodi dimodi Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tag names should make sense when taken outside context. These are not keywords used for SEO. Good candidates are component names and feature names.

Suggested change
tags: gantt, blazor, treelist, width, persist
tags: gantt, blazor, treelist, width

</script>

@code {
private TelerikGantt<FlatModel> GanttRef;
Copy link
Contributor

@dimodi dimodi Jun 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a good practice to create code snippets that do not trigger compile warnings

Suggested change
private TelerikGantt<FlatModel> GanttRef;
private TelerikGantt<FlatModel>? GanttRef { get; set; }

var currentListWidth = await JS.InvokeAsync<string>("getListSize");
ListWidth = currentListWidth;

GanttRef.Rebind();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GanttRef.Rebind();
GanttRef?.Rebind();

var currentListWidth = await JS.InvokeAsync<string>("getListSize");
ListWidth = currentListWidth;

GanttRef.Rebind();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GanttRef.Rebind();
GanttRef?.Rebind();

protected override void OnInitialized()
{
GanttData = new List<FlatModel>();
var random = new Random();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Random.Shared instead for thread safety.

GanttRef.Rebind();
}

class FlatModel
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model classes and data generation should come after the more relevant business logic, methods and events. See the Docs & Demos Code Style Guide in the blazor repo wiki.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-to-production Use this label to get a comment to choose whether to merge the PR to production
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants