Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
Is it possible to have different editors in the same column of either the webdatagrid or webhierarchicaldatagrid?
posted

I have an old web page that is using an ultrawebgrid.  It displays the following:

In the "Value B" column, double-clicking on the 1st cell (Last Name) displays an editable text box with the value (Smith) in it.  If I click on the 6th cell (Adm Code) it displays a drop down list with multiple selectable options.  (Similarly, this is how the other cells in the column work as well.)

Is it possible to achieve this same functionality in either the webdatagrid or webhierarchicaldatagrid?  The old page uses Javascript as follows to achieve this functionality:

function wgrid_BeforeCellChangeHandler(gridName, cellId)
{
    var cell = igtbl_getCellById(cellId); 
    if (cell.Column.Index == 3)
    {
        cell.Column.ColumnType = 0;
        cell.Column.ValueList = null;
        var row = cell.Row;
        var cell0 = row.getCell(0);
        var rowHeader = cell0.getValue();
        if(rowHeader.toLowerCase() == 'gender')
        {
            cell.Column.ColumnType = 5;
            var genders = new Array();
            genders[0] = new Array();
            genders[0][0] = "Male";
            genders[0][1] = "Male";
            genders[1] = new Array();
            genders[1][0] = "Female";
            genders[1][1] = "Female";
            genders[2] = new Array();
            genders[2][0] = "Unknown";
            genders[2][1] = "Unknown";
            cell.Column.ValueList = genders;
        }
        else if(rowHeader.toLowerCase() == 'ethnicity')
        {
            cell.Column.ColumnType = 5;
            
            var ethnicity = new Array();
                         
            for (var i=0; i<EthnicityDescrs.length; i++) 
            { 
                ethnicity[i] = new Array();                
                ethnicity[i][0] = EthnicityDescrs[i]; 
                ethnicity[i][1] = EthnicityDescrs[i];
            } 
            cell.Column.ValueList = ethnicity;
        }          
        else if(rowHeader.toLowerCase() == 'adm code')
        {
            cell.Column.ColumnType = 5;
            
            var admissioncodes = new Array();
                         
            for (var i=0; i<AdmCodes.length; i++) 
            { 
                admissioncodes[i] = new Array();                
                admissioncodes[i][0] = AdmCodes[i]; 
                admissioncodes[i][1] = AdmCodes[i];
            } 
            cell.Column.ValueList = admissioncodes;
        }          
    }
}

It changes the Column.ColumnType property as required.  Can this be achieved using the editor providers?

Thank you!

Sanjay

Parents
  • 1080
    Offline posted

    Hello Sanjay,

    Thank you for posting in our community.

    It is possible to achieve the requirement by using a templated column with all of the needed editor providers. During the OnInitializeRow event you can set any of them to be visible if a condition is met.

    This forum post might be of help to you.

Reply Children