Grid with AutoComplete and updatecell

I have autocomplete in one of my Grid column.Based on value being selected from auto complete. I use that value's code to update one of the cell in grid. to achieve this i am using change event in my autocomplete like below:

However, I get value and grid instance.  but I can not use "updatecell" method. and get this error 

TypeError: this.editModule.updateCell is not a function

change:function(args){
try{
if(args.itemData!=null){
let rId=args.itemData.Code.replace('#','%23');
let items = [];
let gridInstance:Grid=(args.element.closest(".e-grid").ej2_instances[0] as Grid);
gridInstance.updateCell(0,'ResourceId',rId);
}
}catch(e){
console.log(e);
}
}




9 Replies 1 reply marked as answer

RS Rajapandiyan Settu Syncfusion Team June 14, 2022 07:59 AM UTC

Hi,


Thanks for contacting Syncfusion support.


The updateCell method is used only for the Batch edit mode. Before proceeding with your query, we need the following details to provide a better solution.


  1. Share the complete code you have used.
  2. Which type of editing (Inline/Dialog/Batch) you have used?
  3. Did you render the AutoComplete component through columnTemplate/editTemplate?
  4. Explain your requirement in detail.
  5. Are you want to change the other column value based on autoComplete component’s selected value?


Regards,

Rajapandiyan S



PD PDev June 14, 2022 04:20 PM UTC

Can you please share an example which has AutoComplete in Grid. and Based on Selection of value. I need to populate other column in same Row.


Sample Array = [{ "Name":"A",Code:1

} ,

{ "Name":"B",Code:2

} 

]


Upon selecting Name I want to populate Code in other column

Don't want to share my code. which is really messed up and don't want to divert into wrong direction



JC Joseph Christ Nithin Issack Syncfusion Team June 16, 2022 05:38 PM UTC

Hi PDev,


   Thanks for your update.


   Currently we are validating your query, we will provide further details on or before 20th June, 2022. We appreciate your patience until then.


Regards,

Joseph I.



PS Pavithra Subramaniyam Syncfusion Team June 23, 2022 03:28 PM UTC

Hi PDev,


Could you please confirm what type of edit mode you are using in your
“editSettings” based on which we could prepare an appropriate solution and share a sample with you. Because each edit type has a different edit form structure by default.


Regards,

Pavithra S



PD PDev June 24, 2022 10:54 AM UTC

It's Normal



JC Joseph Christ Nithin Issack Syncfusion Team July 1, 2022 01:39 AM UTC

Hi PDev,


Thanks for your update.


   Currently we are validating your query, we will provide further details on or before 4th July, 2022. We appreciate your patience until then.


Regards,

Joseph I.



RS Rajapandiyan Settu Syncfusion Team July 7, 2022 06:38 AM UTC

Hi PDev,


Thanks for your patience.


In Inline Edit, you can directly get the other column’s input element using its id to change the value. We have prepared a simple sample for your reference, you can get it from the below link.


Sample: https://stackblitz.com/edit/angular-b5qcu2?file=app.component.ts,app.component.html


 

          change: function (args) {

            if (args.itemData) {
              // get the other column’s input element using its id (grid + Code = Grid element id + column’s field name )

              (document.getElementById('grid' + 'Code') as any).value = args.itemData.Code;

            }

          },

 


Please get back to us if you need further assistance.


Regards,

Rajapandiyan S



PD PDev November 1, 2022 07:53 AM UTC

In your above sample, If I change this

fields: { text: 'Name', value: 'Name' },

to

fields: { text: 'Name', value: 'Code' },


Auto Complete does not work... Can you please help here ?



JC Joseph Christ Nithin Issack Syncfusion Team November 3, 2022 02:49 AM UTC

Hi PDev,


  Based on your query, when you set the `field.value` property to Code from Name, the autocomplete was not working. By default, field.text property maps the text column from the data table for each list item and the field.value property Maps the value column from the data table for each list item. The filter action will be based on the field.value property. In your case, Since you have changed the field.value property to Code, you have to type the Code values for the autocomplete to filter the data items from the list. Refer to the video below.


Video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/WINDOW~2664991372


Sample: https://stackblitz.com/edit/angular-b5qcu2-3h4xw5?file=app.component.ts,app.component.html


Regards,

Joseph I.


Marked as answer
Loader.
Up arrow icon