1

Have datatable and table contains two dropdowns(disabled mode) for every columns. While checkbox checked need to enable dropdowns. Im able to enable only dropdown, second dropdown box not enabled. Tried below code, could you please help me how to enable dropdowns,

<td><input [(ngModel)]="person.check" [checked]="isChecked" type="checkbox" class="checkboxCls"></td>

<td>
     <select [disabled]="!person.check?true:null" [(ngModel)]="person.test2">
                <option value=""></option>
                <option value="test1">test1</option>
                <option value="test2">test2</option>
     </select>
 </td>

Working Demo

3 Answers 3

1

Rearrange the columns in dtOptions is working fine.

this.dtOptions = {
          processing: true,
          destroy: true,
          columns: [
            { name: "" },
            { data: "index" },
            { title: "Dropdown" },
            { title: "Dropdown2" },
            { data: "firstname" },
            { data: "lastname" }
      ]
  };
Sign up to request clarification or add additional context in comments.

1 Comment

Yeah got it, I rearranged as per the above, working fine now.
0

I don't know what is that DataTableDirective but if you remove your dtOptions from table, your code works like the expected behavior. So you need to fix dtOptions columns I guess.

Comments

0
[disabled]="!person.checked"

This should work fine

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.