Dropdown with different options in a column

Tags: #<Tag:0x00007efc709358f0> #<Tag:0x00007efc70935760>

I want Cell type as dropdown with different option in same column based on value of other cell in same row.

for example i have 2 columns, category and source.

if category cell having specific value then I want to show different options in source cell dropdown

can i do this?

Hi @jamshaidbutt055

What you need is cell dependencies. Here we have an example of how it can be done: https://jsfiddle.net/handsoncode/gsn7txbd/ I hope that helps.

@adrian.szymanski I want to keep it simple, here is what I need to do.

 cells:(row, column) => {
   const categoryColData = instance.getDataAtCell(
         row,
         4
       );
       const isBaseRow = categoryColData
         ? categoryColData.includes("[", 0)
         : true;
       console.log(categoryColData, isBaseRow);
      return isBaseRow && column === 5
        ? {
            type: "dropdown",
            source: ["formula", "input", "data", "aggregate"],
            renderer: customRenderer,
          }
        :!isBaseRow && column === 5
        ?{
            type: "dropdown",
            source: ["formula", "input", "data"],
            renderer: customRenderer,
          } : {
            type: "text",
            renderer: customRenderer,
          };
    }, 

Now I don’t know how can I get value of column category in cells function. in custom renderer. I tried to get value but it is giving null. but for other cells its giving proper value. why is it so?

demo
https://jsfiddle.net/yd0mzsca/

@jamshaidbutt055

Without knowing your current support plan I can only provide guidance with the examples that we already have. As this is heavily customized implementation I will need your current plan first. Please, send me your license ID at support@handsontable.com so I can check it.

Thank you for your help. I have achieved what I wanted by changing source of cellProperty in renderer function.

const categoryColData = instance.getDataAtCell(row, 4);
const isBaseRow = categoryColData ? categoryColData.includes("[", 0) : true;
if (isBaseRow)
    cellProperties.source = ["formula", "input", "data", "aggregate"];

Hi @jamshaidbutt055

Thank you for the update. I’m glad that you were able to solve the issue. I will close this topic now.