vitalets / x-editable

In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
http://vitalets.github.io/x-editable
MIT License
6.51k stars 1.72k forks source link

Empty value removed when the xeditable is disabled #1067

Open cscmalaga opened 6 years ago

cscmalaga commented 6 years ago

Hi,

When I disable a xeditable element with an empty default value, the value disappears (like in the right element below):

xeditable-disable

Is this the normal behavior or I'm doing something wrong?

This is the code that generates the right element:

            <a href="#"
              class="xeditable"
              data-type="text"
              data-pk="{{ patient.getId() }}"
              data-name="email_manual"
              data-title="{{ 'Email (manual entry)' | t }}"
              data-emptytext="{{ patient.getEmail() | default('n/c') }}">
              {{ patient.getEmailManual() }}
            </a>
shreyas-sja commented 6 years ago

We have resolved this by using js as follow: $('#SurveyCompletec').editable("option", "disabled", true); $('#SurveyCompletec').html('n/c');