Change the editor of the particular cell of a selected row

edited September 27 in Technical questions

Hi,

I have scenario, where i need to set the editor of the particular cell of a selected row,as of with the editor of the item selected in the combo suggest list in the same row.And the new editor value added up should not reflect on the entire column but only to the selected row.

Kindly have look on to the below code snippet for your reference:
https://webix.com/snippet/43a6bd52

Please suggest the better solution.

Thanks in advance,

Warm regards,
Kaleem B N

Comments

  • Please share any suggestions to take it further and if you have any clarifications,Please let me know.

    Thanks in advance,

  • Hi Webix team,

    Is it possible to make the editor switch between two cells with respect to the row level rather than entire column in data table.

    for eg: I have a combo editor in one cell and on making a selection of the options and based on the editor of the options ,the editor of the targeted cell has to change ,only in the row level but not in entire data table.

    warm regards,
    Kaleem B N

  • edited September 27

    Hi Kaleem,

    Technically it it possible, so please ensure to take the following steps:

    1. Define a column which will be the editor "selector" and populate it with the corresponding data. In you case it is 1 for "text" editor and 2 for "editdate".
    data:[
        { name:"", age:"", state:"", ed: 1} //for text
        { name:"", age:"", state:"", ed: 2} //for editdate
    ]
    

    Define a collection for this column to display text values for each editor, not number:

    { id: "ed", header: "Type", editor:"combo", collection:controls, suggest:{}}
    

    In the onBeforeEditStart handler check the column's current editor and its required editor (in the neighbouring column). If they do not coincide, replace the editor at runtime:

    onBeforeEditStart:function(id){
      if(id.column === "state"){
        var neededId = this.getItem(id.row).ed; // 1 for text, 2 for date
        var neededEd=this.getColumnConfig("ed").collection.getItem(neededId).editor;
        var currentEd = this.getColumnConfig(id.column).editor;
    
        //current editor does not coincide with the needed editor
        if(neededEd != currentEd)
           this.getColumnConfig(id.column).editor = neededEd;
       }
    }
    

    Please, have a look at the whole snippet: https://webix.com/snippet/b1a88786

  • Thanks a lot Helga for your help. You are awesome...Thanks again

  • Hi Helga,

    I got the editor as needed but when I add the third editor as "combo" then the next column "state" is taking the same options as it was there in the previous column editor.

    Please kindly have a look and share the appropriate way to have different combo for the selected combo editor in the drop down.
    https://webix.com/snippet/6863f2cd

    please let me know,if any info is needed.

    Regards,
    Kaleem B N

  • Hi Helga,

    Please consider the below snippet for my query:
    https://webix.com/snippet/3d6439fc

    Regards,
    Kaleem B N

  • Hi Helga,

    Is there a way to have two columns for validation and prevent the editing other row unless the row validation is satisfied.

    Please have look of the snippet below for your reference:
    https://webix.com/snippet/cb77b496

    Thanks in advance,

    Regards,
    Kaleem B N

  • Hi Helga,

    Waiting for your response.

    Regards,
    Kaleem B N

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion