add textarea input inside ejGrid

Hello Support,

Im trying to create ejGrid with dynamic inputs and want to create textarea input in case if condition

so im' tried this to create the textarea input:

 { field: "test", headerText: "test", required: true, editTemplate: { create: function () { return "<textarea  rows='4' cols='50'>"; }, write: function (args) { args.element.ejMaskEdit({ inputMode: ej.InputMode.Text, width: "100%" }); } } }

it works fine and shows the textarea, but on add I got error :

Uncaught TypeError: y is not a function
    at Object.endEdit (ej.web.all.min.js:10:3237650)
    at n.fn.init.n.fn.<computed> [as ejGrid] (ej.web.all.min.js:10:24347)
    at Object._buttonClick (ej.web.all.min.js:10:3223952)
    at HTMLInputElement.<anonymous> (ej.web.all.min.js:10:27780)
    at HTMLDivElement.dispatch (jquery.min.js:3:7516)
    at HTMLDivElement.r.handle (jquery.min.js:3:5597)

thank you



1 Reply

PS Pon Selva Jeganathan Syncfusion Team January 24, 2022 02:32 PM UTC

Hi Ali Ossaily, 
 
Thanks for contacting syncfusion forum. 
 

Query: add textarea input inside ejGrid

 
We were able to reproduce the issue at our end while preparing a sample based on your code snippet. To avoid this issue, we suggest you follow the below code example, 
 
 
Your code: 
 
 { field: "test", headerText: "test", required: true, editTemplate: { create: function () { return "<textarea  rows='4' cols='50'>"; },  
write: function (args) { args.element.ejMaskEdit({ inputMode: ej.InputMode.Text, width: "100%" }); } } } 
 
 
Modified code: 
{ field: "ShipCountry",editTemplate : { 
                                                                        create : function () { 
                                                                                                     return "<textarea  rows='4' cols='50'>"; 
                                                                        }, 
                                                                        read : function (args) { 
                                                                                      return args.val(); 
                                                                        }, 
                                                                        write : function (args) { 
                                                                                                 $("textarea").css("width","100").val(args.rowdata.ShipCountry); 
//assign the value to the control    
                                                                                       
                                                                        } 
 
Please refer to the below sample, 
 
Kindly get back to us for further assistance. 
 
Regards,   
Pon selva   


Loader.
Up arrow icon