We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Find ejGrid cell information on RecordDoubleClick or on cellEdit

How to find cell information like, field, headerText, cell type on RecordDoubleClick event of ejGrid ?

Please note in my one of case header text and field is different but on RecordDoubleClick it gives me column name as header text. Why it is not giving actual field ?
Also note cellEdit is not working in my case. I want to show normal text in cell in case of grid load complete. But on cell edit, I have to change its type to dropdown. Now I am unable to bind data to that cell using Ajax. If I get information like field name and field edit type like whether it is drop down or normal text box then it will be little helpful to me to use Ajax call to fetch and bind data to dropdown.

Thanks.

1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team June 21, 2016 10:39 AM UTC

Hi Prasad, 

Thank you for contacting Syncfusion support.   
  
To find the cell information, use getColumnByHeaderText method of ejGrid. In the recordDoubleClick event, we can get columnName as HeaderText in the arguments. Using that we can get the column and store in a variable.   
  
In the actionComplete event, we check the condition with the field and editType using column variable and change the type to dropdown. We also bind the DataSource for the dropdown using ajax Post.   

Find the code example and sample: 


<div id="FlatGrid"></div> 
<script> 
 
    var column, flag; 
    
        $("#FlatGrid").ejGrid({ 
            dataSource: window.gridData, 
---------------------------------------- 
            actionComplete: "complete", 
            recordDoubleClick : "click", 
            columns: [ 
                ------------------------ 
               { field: "ShipCountry", headerText: "Ship Country" }, 
                { field: "ShipCity", headerText: "Ship City" } 
            ], 
            allowPaging: true 
        }); 
 
        function complete(args) { 
            if (args.requestType == "beginedit" || args.requestType == "add") 
            { 
                if (column.field == "ShipCountry" && column.editType == "stringedit" && flag) { 
                    var grid = this._id; 
                    $.ajax({ 
                        url: '/Grid/EmployeeID', 
                        type: 'GET', 
                        success: function (data1) { 
                            $("#" + grid + "ShipCountry").ejDropDownList({ dataSource: data1 }); 
                            
                        } 
                    }); 
                } 
                flag = false; 
            } 
        } 
 
        function click(args) { 
            if (args.columnName == "Ship Country") { 
                column = this.getColumnByHeaderText(args.columnName); 
                flag = true; 
            } 
        } 
</script> 


Regards, 
Prasanna Kumar N.S.V 
 


Loader.
Live Chat Icon For mobile
Up arrow icon