Disable dropdown for certain usergroups based on same dropdown value

Disable dropdown for certain usergroups based on same dropdown value

rob1strob1st Posts: 74Questions: 18Answers: 0
edited August 23 in Editor

Hi all,

Just trying to figure out how we do this.

I have a drop down that has "1, 2, 3, 4, 5, 6"

I want to disable this dropdown from user group A if the dropdown has above 3 selected.

I tried adding an if into the data:

{ data: "assetStatus",
  "render": function ( data, type, row, meta ) {
    if((data != '1' || data != '2' || data != '3') && permission == 'A') {
      editor.disable( [
        'dropdown',
      ] );
    }
  }
},

Datatables didn't like that.

I tried a separate query

if((row['dropdown'] != '1' || row['dropdown']!= '2' || row['dropdown']!= '3') && permission == 'A') {
    editor.disable( 
      [
        'dropdown'
      ] 
    );
  }

Datatables didn't like that either.

Anyone have an idea how to do this?

Answers

  • rob1strob1st Posts: 74Questions: 18Answers: 0

    ok, figured it, I'm an idiot. forgot to add the return data.

    { data: "assetStatus",
            "render": function(data) {
              if((data == '1' || data == '2' || data == '3') && permission == A) {
                editor.enable(
                  ['dropdown']
                )
              } else if (permission == B) {
                editor.enable(
                  ['dropdown']
                )
              } else {
                editor.disable(
                  ['dropdown']
                )
              }
              return data;
            }},
    
Sign In or Register to comment.