I'm using the x-editable plug-in to have in-place edits and it works well.
我使用的是x-editable插件来进行就地编辑,而且效果很好。
The following jsfiddle shows an example from their documentation: http://jsfiddle.net/ibrahima_yock/CFNXM/27/
下面的jsfiddle展示了他们的文档示例:http://jsfiddle.net/ibrahima_yock/CFNXM/27/。
<div>
<span>Status:</span>
<a href="#" id="status"></a>
</div>
.
。
//make status editable
$('#status').editable({
type: 'select',
title: 'Select status',
placement: 'right',
source: [
{value: 1, text: 'status 1'},
{value: 2, text: 'status 2'},
{value: 3, text: 'status 3'}
]
});
As you can see in the jsFiddle, in the html pane the status is "empty" (written in red). We'd like to translate that word into another language. How can we specify it?
正如您在jsFiddle中看到的,在html窗格中,状态为“空”(用红色表示)。我们想把这个词翻译成另一种语言。我们如何指定它?
3 个解决方案
#1
29
You just add this option when setting up the field:
您只需在设置字段时添加此选项:
emptytext: 'Leer', // default is 'Empty'
Fiddle: http://jsfiddle.net/Saran/hdVYS/
小提琴:http://jsfiddle.net/Saran/hdVYS/
You can find other options in the documentation.
您可以在文档中找到其他选项。
#2
7
For those who prefer to use attributes, data-emptytext
is another way to accomplish this:
对于那些喜欢使用属性的人来说,data-emptytext是另一种实现方法:
<a href='#' id='status'
data-placeholder='This text appears when editing'
data-emptytext='This text appears when field is empty'> </a>
#3
0
@Saran negative, there is method "toggleDisabled" (bootstrap-editable.js line 1679) which turn off event click propagation. And this is my problem, when I switch it off, value is empty (i would like to see default value for "empty" value). In editable is property "handleEmpty" which clears empty value (bootstrap-editable.js line 1770) in the case that option disabled is to true and value is empty. I am trying to figure out how to rewrite this value to something else without touching library code
@Saran negative,有方法“toggleDisabled”(bootstrap-editable)。js行1679)关闭事件点击传播。这是我的问题,当我关闭它时,值是空的(我希望看到“空”值的默认值)。在editable中,属性“handleEmpty”可以清除空值(bootstrap-editable)。在禁用选项为true且值为空的情况下。我想知道如何在不接触库代码的情况下将这个值改写成其他东西。
#1
29
You just add this option when setting up the field:
您只需在设置字段时添加此选项:
emptytext: 'Leer', // default is 'Empty'
Fiddle: http://jsfiddle.net/Saran/hdVYS/
小提琴:http://jsfiddle.net/Saran/hdVYS/
You can find other options in the documentation.
您可以在文档中找到其他选项。
#2
7
For those who prefer to use attributes, data-emptytext
is another way to accomplish this:
对于那些喜欢使用属性的人来说,data-emptytext是另一种实现方法:
<a href='#' id='status'
data-placeholder='This text appears when editing'
data-emptytext='This text appears when field is empty'> </a>
#3
0
@Saran negative, there is method "toggleDisabled" (bootstrap-editable.js line 1679) which turn off event click propagation. And this is my problem, when I switch it off, value is empty (i would like to see default value for "empty" value). In editable is property "handleEmpty" which clears empty value (bootstrap-editable.js line 1770) in the case that option disabled is to true and value is empty. I am trying to figure out how to rewrite this value to something else without touching library code
@Saran negative,有方法“toggleDisabled”(bootstrap-editable)。js行1679)关闭事件点击传播。这是我的问题,当我关闭它时,值是空的(我希望看到“空”值的默认值)。在editable中,属性“handleEmpty”可以清除空值(bootstrap-editable)。在禁用选项为true且值为空的情况下。我想知道如何在不接触库代码的情况下将这个值改写成其他东西。