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.
Unfortunately, activation email could not send to your email. Please try again.

Find ejGrid cell information on RecordDoubleClick or on cellEdit

Thread ID:

Created:

Updated:

Platform:

Replies:

124640 Jun 20,2016 09:35 AM Jun 21,2016 06:39 AM JavaScript 1
loading
Tags: ejGrid
Prashant Prasad
Asked On June 20, 2016 09:35 AM

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.

Prasanna Kumar Viswanathan [Syncfusion]
Replied On June 21, 2016 06:39 AM

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 
 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;