rails bootstrap x-editable emptytext -


i'm using bootstrap x-editable in rails app. replace word empty in table cell name of field.

the x-editable documentation says emptytext replace it.

but, following doesn't work - still empty.

<a href="#" class="answer" data-type="textarea" emptytext="description" data-pk="1" data-resource="task" data-source="/tasks" data-name="longdesc" data-url="/tasks/<%= task.id %> "> 

this javascript:

  $(".answer").editable     placement: 'bottom' 

thanks help.

it's not emptytext="description" data-emptytext="description".

<a href="#" class="answer" data-type="textarea" data-emptytext="description" data-pk="1" data-resource="task" data-source="/tasks" data-name="longdesc" data-url="/tasks/<%= task.id %> "> 

you can in javascript instead of inline html.

$('.answer.description').editable({     placement: 'bottom',     emptytext: 'description' }); 

edit html5

look here html5 data-attribute. why x-editable's settings start data-*.

edit answering comment

you can in official demo look @ sex select prepend data (and display tweak):

$('#sex').editable({     prepend: "not selected",     source: [         {value: 1, text: 'male'},         {value: 2, text: 'female'}     ],     display: function(value, sourcedata) {         var colors = {"": "gray", 1: "green", 2: "blue"},         elem = $.grep(sourcedata, function(o){return o.value == value;});         if(elem.length) {             $(this).text(elem[0].text).css("color", colors[value]);         } else {             $(this).empty();         }     } });  

or can directly add sourcedata {value: 0, text: 'null'}


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -