Telerik Forums
Kendo UI for Angular Forum
0 answers
602 views
Hello,

I'm using the Kendo Grid for Angular and it's showing some weird behavior. I have some hidden columns and a column menu for toggling the visibility. I have a situation where certain columns load hidden and I can't unhide them even with the column menu.

We are trying to cache the user's grid settings. We've enabled column reordering and toggling visibility. Whenever the user hides/shows or reorders a column, we cache the state of the columns in localStorage. And when the user revisits the page, we check for a cached version of the columns and restore it if it exists.

For some reason, when the cached columns are restored, I can't unhide the hidden columns. I go to the column menu, and it's unchecked (which means hidden), but when I check it and then hit apply, the column is still hidden. I look back in the menu and it's still checked. In the code, I look at the state of the column in grid.columns, and it shows that 'hidden' is set to true.

Here is my code:

    ngAfterViewInit(): void {
        // Reordering columns can fail if done before the current Angular digest cycle is complete,
        // therefore, set timeout with 0 seconds so that it fires immediately after the digest cycle:
        setTimeout(() => {
            this.restoreColumnsFromCache(this.StorageName);
        });
        this.subscribeToColVisibilityChange();
    }
	
	public subscribeToColVisibilityChange(): void {
        this._colVisibilityChangeSub = this.grid.columnVisibilityChange.subscribe(
            ($event: ColumnVisibilityChangeEvent) => {
                this.cacheColumnsState(
                    {
                        changedColumns: $event.columns
                    },
                    this.StorageName
                );
            }
        );
    }
	
	public restoreColumnsFromCache(storageName: string): void {
        this._suppressReorderHandler = true;
        const columns = localStorage.getItem(storageName);
        if (columns) {
            // Column reordering is buggy when hidden columns exist.
            // Show all columns until we're done reordering:
            this.grid.columns.forEach(c => c.hidden = false);

            setTimeout(() => {
                // Reorder columns:
                const columnsParsed: ColumnInfo[] = JSON.parse(columns);
                columnsParsed.forEach((ci: ColumnInfo, index: number) => {
                    const gridColumn = this.grid.columns.find((gridCol: any) => gridCol.title === ci.title);
                    if (gridColumn) {
                        this.grid.reorderColumn(gridColumn, index);
                    }
                });

                // Restore column hidden states:
                this.grid.columns.forEach(c => {
                    const cachedColumn = columnsParsed.find(cachedCol => cachedCol.title === c.title);
                    c.hidden = cachedColumn ? !cachedColumn.isVisible : false;
                });

                this._suppressReorderHandler = false;
            });
        } else {
            this._suppressReorderHandler = false;
        }
    }

Can anyone see why hidden columns won't show after loading them from the cache?
Gibran
Top achievements
Rank 1
 asked on 15 Aug 2021
1 answer
949 views

Hi Team,

I'm creating one module to apply the style dynamically.
In that I'm using form as reactive form.
I used Kendo Button Group to select font weight & style like bold, italic and underline.
For the same I used BIU as different button in button group.
But I'm not able to apply the formControlName.

How can I do that?

 

Svet
Telerik team
 answered on 13 Aug 2021
0 answers
199 views

Hi Team,

In kendo-grid kendo-grid-column already added but i have added more columns that is received from API now i have pass that dynamic data in child component but in my case its generating but issue is that component data not rendered in view.can anybody tell me how to do it?

 

<kendo-grid [reorderable]="true" [ngClass]="{gridloading:gridLoadingEnabled == true}" [kendoGridBinding]="data" [loading]="gridLoadingEnabled" [resizable]="true"> <kendo-grid-column field="TaxPercent" title="{{'CommonPercentage' | translate}}"></kendo-grid-column> <kendo-grid-column field="TotalLC" title="{{'CommonTotal(LC)' | translate}}"></kendo-grid-column> <!-- Dyamically added columns--> <app-udf-item-details [udfItemDetailData]="columnList"></app-udf-item-details> </kendo-grid>

  <!-- Child component-->
  <h3 class="sub-title" >Basic Details</h3>
  <div class="form-group">
    <div class="col-md-6" *ngFor="let column of  columnList" style="padding:4px;">
          <label for="{{column.id}}" class="col-md-4 control-label">{{column.name}}</label>
          <div class="col-md-8">
            <input type="text"
              name="{{column.id}}" class="form-control" id="{{column.id}"
              disabled>
          </div>
    </div>    
  </div>
kapil
Top achievements
Rank 1
 updated question on 12 Aug 2021
1 answer
349 views

Hi,

Not able to install kendo theme bootstrap. What is wrong with me

 

Stoyan
Telerik team
 answered on 11 Aug 2021
1 answer
1.2K+ views

Hi,

When using Material theme with kendo grid, there's no border between columns. When doing column resizing, only column header has a resizer vertical line showing. Is it possible to also show a separation line between normal column cells when resizing columns? How to customize css to achieve this?

Thanks,

Randy

Svet
Telerik team
 answered on 11 Aug 2021
1 answer
2.8K+ views
I want to change the default color of the kendo elements from orange to blue. Initially, it was blue for the past few months. And, now from the past few weeks it has changed to orange. All the colors are orange right from the numbers and the apply filter buttons in the kendo grid pagination to the options in the multiselect and dropdown list. Please, someone help me out with this. This is urgent.

Thank You in advance!
Hetali
Telerik team
 answered on 10 Aug 2021
2 answers
1.5K+ views

Hi Guys,

Why does the kendo-grid-column-chooser component not fire dataStateChange so any changes to selected columns can be persisted?

 

On my grid I have the following command:

(dataStateChange)="dataStateChange($event)"

And I have even tried:

<kendo-grid-column-chooser (dataStateChange)="dataStateChange($event)" class="pull-right"></kendo-grid-column-chooser>

But neither command fires dataStateChange from the column chooserIs there a solution to this?

Cheers,
Bob

Bob
Top achievements
Rank 1
Iron
Iron
Iron
 updated answer on 10 Aug 2021
1 answer
190 views

Given a simple sparkline with static data:


            <kendo-sparkline [chartArea]="{background: ''}"
              style="width:30px; height:30px;"
              type="pie">
              <kendo-chart-series>
                <kendo-chart-series-item [data]="[1,1,1]"
                  [color]="['green', 'yellow', 'red']"
                  [labels]="['Closed', 'Doing or Done', 'To do']"
                  field="value"
                  categoryField="label">
                  <kendo-chart-series-item-tooltip>
                    <ng-template let-category="label"
                      let-value="value">
                      {{category}}: {{value}}
                    </ng-template>
                  </kendo-chart-series-item-tooltip>
                </kendo-chart-series-item>
              </kendo-chart-series>
            </kendo-sparkline>
How do i display the label only in the tooltip?  I have tried using "category" and even a category axis bit to no avail.
Slavena
Telerik team
 answered on 09 Aug 2021
1 answer
777 views
After exporting the excel file, after generating the file, how can I track the file download has started and when will it end?
Silviya
Telerik team
 answered on 09 Aug 2021
0 answers
54 views

Hi,

 

Do you have an complete sample with in same page many components like calendar, scheduler and grid dialoging together with an service ?

Regards

bahaso
Top achievements
Rank 1
Iron
Iron
Iron
 asked on 07 Aug 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?