sn-choice-list making readonly

B Praveen Rao
Tera Contributor

Hi,

I am trying to build a custom widget where I am trying to use the sn-choice-list and sp-date-picker for the choice dropdown and datetime fields.

I have a requirement to make those fields read only and editable based on a "Edit" button.

When I try using direct scope element it's working fine 

<sn-choice-list sn-disabled="fieldReadOnly" sn-model="c[field.name]" sn-options="field.choiceListOption" sn-value-field="value" sn-text-field="display_value" sn-items="field.choices"></sn-choice-list>

When I try to use directive under the ng-repeat and passing the dynamic 'c' object it's not working (either a boolean or function)

<sn-choice-list sn-disabled="c[field.readonly]" sn-model="c[field.name]" sn-options="field.choiceListOption" sn-value-field="value" sn-text-field="display_value" sn-items="field.choices"></sn-choice-list>

OR

<sn-choice-list sn-disabled="field.isReadOnly()" sn-model="c[field.name]" sn-options="field.choiceListOption" sn-value-field="value" sn-text-field="display_value" sn-items="field.choices"></sn-choice-list>

Thanks in advance.

1 ACCEPTED SOLUTION

Snehangshu Sark
Mega Guru

Hi @B Praveen Rao ,

 

Try this:

 

<sn-choice-list readOnly = "{{c.readOnlyChoiceList}}"></sn-choice-list>

 

Replace readOnlyChoiceList with fieldReadOnly.

 

Regards,

Snehangshu Sarkar

Please mark my answer as correct if it resolves your query. 

View solution in original post

2 REPLIES 2

Snehangshu Sark
Mega Guru

Hi @B Praveen Rao ,

 

Try this:

 

<sn-choice-list readOnly = "{{c.readOnlyChoiceList}}"></sn-choice-list>

 

Replace readOnlyChoiceList with fieldReadOnly.

 

Regards,

Snehangshu Sarkar

Please mark my answer as correct if it resolves your query. 

Thanks ng-readonly worked.

 

<sn-choice-list ng-readonly="c[field.readonly]" sn-model="c[field.name]" sn-options="field.choiceListOption" sn-value-field="value" sn-text-field="display_value" sn-items="field.choices"></sn-choice-list>

 

But it's not working in <sp-date-picker> directive