Skip to content
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

ComboBox in Aggrid Cell #3193

Closed
lgowrinadh opened this issue Jun 10, 2019 · 20 comments
Closed

ComboBox in Aggrid Cell #3193

lgowrinadh opened this issue Jun 10, 2019 · 20 comments

Comments

@lgowrinadh
Copy link

Hi,

Please help us in integrating Angular 6 Combo-box or Kendo-Combo-box in Ng-Grid cell with List of Elements. We have tried a lot but didnt got enough results in google. Please help on this.

@jiangyh1024
Copy link

jiangyh1024 commented Jun 11, 2019

@lgowrinadh
Hi do you mean this?


import { Component, ViewChild } from '@angular/core';
import { ComboBoxComponent } from '@progress/kendo-angular-dropdowns';
import { ICellEditorAngularComp } from 'ag-grid-angular';

@Component({
  selector: 'app-select-cell-editor',
  template: `<kendo-combobox #kendoCombobox (valueChange)="onValueChange()"
  [clearButton]="clearButton" style="width:100%" [data]="dropdownData"
  textField="text" [popupSettings]="{'width': '150px'}" valueField="value" [valuePrimitive]="true" [(ngModel)]="value"></kendo-combobox>`
})
export class SelectEditorComponent implements ICellEditorAngularComp {

  //#region Properties

  public dropdownData: any;
  public value: any;
  public clearButton: boolean;

  @ViewChild('kendoCombobox')
  private kendoCombobox: ComboBoxComponent;

  private params: any;

  //#endregion

  //#region Events

  public agInit(params: any): void {
    this.params = params;
    this.value = params.value;
    this.dropdownData = params.values;
    this.clearButton = !!params.clearButton;

    // open it
    this.kendoCombobox.toggle(true);
  }

  public onValueChange(): void {
    this.params.api.stopEditing();
  }

  public getValue(): any {
    return this.value;
  }

  //#endregion
}

and use it in aggrid
image
image
image

image

@jiangyh1024
Copy link

you mean Viewchild did not get the instance of kendo combobox?? that's weird.

@jiangyh1024
Copy link

can u post your code?

@jiangyh1024
Copy link

jiangyh1024 commented Jun 11, 2019

I am confused. why u use kendogridedittemplate directive? if you want to pass rowindex to the select editor. pass it through params. see cellEditorSelector,

@jiangyh1024
Copy link

return {component: 'selectEditorComponent',
params:{
rowIndex: this can be get from CellEditorSelecor
}}

@jiangyh1024
Copy link

yes, just add rowindex below values property and get it from params you can console.log(params) to find the rowindex

@jiangyh1024
Copy link

and in your selectEditorComponent, in agInit function , you can get rowindex by calling params.rowindex

@jiangyh1024
Copy link

or you even do not need to pass rowindex. because you can get it directly from params in aginit function, just print it and see

@madhukudala
Copy link

madhukudala commented Jul 4, 2019

@jiangyh1024
When I use kendo combo box as you suggested above it's rendering. But I am facing below issues

Let's say you have 4 columns and you have combo box in coulmn 3 and rest are inputs
Entered value in col 1 and clicked tab it moved col 2 and I am able to enter value directly
Entered value in col 2 and clicked tab it moved col 3 it's focused but
I am unable to enter value directly and when click tab it's not moving to col 4

And I am not getting the custom value entered. But the same code working independently out side of the grid.

<kendo-combobox tabindex="-1" #kendoCombobox [clearButton]="true" [data]="dropDownData" [allowCustom]="true" [filterable]="true" (filterChange)="onFilterChange($event)" (valueChange)="onValueChange(dropDownValue)" [(ngModel)] = "dropDownValue"> </kendo-combobox>

Do you have any solution for this?

@jiangyh1024
Copy link

jiangyh1024 commented Jul 5, 2019

@madhuinwiter use cell editor
image
image

call focus methods

pressing tab key to the next cell does not work for me only when I put the grid in a dialog (primeng dialog). when I debug it, the next cell is actually focused
image

image

But after exiting debug mode, the focus is lost. I don't know why.
image

you can try to add a breakpoint here to see if the next cell is focused after pressing tab key

image

@jiangyh1024
Copy link

I found that it is something related to tabindex on others component

@madhukudala
Copy link

@jiangyh1024
What about the value that enter in combo box is getting erased when I press TAB?

@jiangyh1024
Copy link

@madhuinwiter if u want to keep the custom select value, then put it to your dropdown datasource
when exiting edit mode 'getValue()' method will be called, just add it to you dropdown datasource and return the value you input

@MalleswaraoBandi
Copy link

MalleswaraoBandi commented Jul 9, 2019

Here I have given custom value in kendo combo box and pressed tab the custom entered data got erased.
Kendo-combobox-customValue
Here the custom entered value got erased.
image
image

image
image

After selecting the value with arrow keys and press tab also loosing the selected value.
image

@jiangyh1024
Copy link

jiangyh1024 commented Jul 9, 2019

...Your dropdown data source is not updated.

@MalleswaraoBandi
Copy link

How to updated the data source with custom value and I am loosing the selected value on tab click.

@stale
Copy link

stale bot commented Aug 3, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Aug 3, 2019
@stale stale bot closed this as completed Aug 8, 2019
@biels
Copy link

biels commented Oct 2, 2020

What is the standard way of putting a combobox / dropdown / typeahead cell editor in ag-grid in 2020? Not even the enterprise version of the select cell editor has search functionality at the moment.

@gportela85
Copy link
Member

@biels The agRichSelect will search for values as you type, but it doesn't have a textfield with the typeahead functionality built-in. If you need something more elaborate for your project the advice is to go with your own custom components.

You can check the agRichSelect by going to the main demo: https://www.ag-grid.com/example.php and editing a cell in the country column.

@biels
Copy link

biels commented Oct 2, 2020

Okay, thanks for your reply. Do you have have any reference to an implementation or how to implement such custom control?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants