-
-
Notifications
You must be signed in to change notification settings - Fork 34
Setting emptytext for editableColumn not possible #127
Comments
It's possible to overwrite, just add 'emptytext' to X-editable plugin options - array(
'class' => 'editable.EditableColumn',
'name' => 'virtual_field',
'value' => 'CHtml::value($data, "profile.language")',
'editable' => array(
'emptytext' => 'Some text here',
'type' => 'text',
'attribute' => 'profile.language',
'url' => $this->createUrl('site/updateProfile'),
'placement' => 'left',
)
), |
What I have:
The column shows:
Then when you click to edit, it has a single space in text box. |
Try this $this->widget('editable.EditableDetailView', array(
'data' => $model,
'emptytext' => 'no value',
'attributes' => array(
array(
'name' => 'ad_n',
'header' => 'Add. Neg. Breakout',
'editable' => array(
'type' => 'text',
'url' => $this->createUrl('ajax/updateWtch'),
'placement' => 'right',
),
),
)
)); |
@Julian-B90 So forced to use a listview, as will not work with:
|
supports the 'emptyText' property because it extendet from the CGriedView |
I get: The full code: <?php $this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'wtchgrid',
'itemsCssClass' => 'table-bordered items',
'dataProvider' => $watchData,
'emptytext' => 'no value',
'columns'=>array(
...
array(
'class' => 'editable.EditableColumn',
'name' => 'ad_n',
'header' => 'Add. Neg. Breakout',
'editable' => array(
'url' => $this->createUrl('site/updateWtch'),
'placement' => 'right',
),
),
...
),
)); |
maybe <?php $this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'wtchgrid',
'itemsCssClass' => 'table-bordered items',
'dataProvider' => $watchData,
'blankDisplay' => 'no Value',
'nullDisplay' => 'no Value',
'columns'=>array(
...
array(
'class' => 'editable.EditableColumn',
'name' => 'ad_n',
'header' => 'Add. Neg. Breakout',
'editable' => array(
'url' => $this->createUrl('site/updateWtch'),
'placement' => 'right',
),
),
...
),
)); |
@Julian-B90 Thanks. When I use: However if I use: |
ok now i remeber for the right solution. <?php
class TestModule extends CWebModule
{
public function init()
{
// this method is called when the module is being created
// you may place code here to customize the module or the application
//assume you unzipped extension under protected/extensions/x-editable
Yii::setPathOfAlias('editable', Yii::getPathOfAlias('ext.x-editable.*'));
// import the module-level models and components
$this->setImport(array(
'test.models.*',
'test.components.*',
'editable.*'
));
$component = Yii::createComponent(array(
'class' => 'editable.EditableConfig',
'form' => 'bootstrap', //form style: 'bootstrap', 'jqueryui', 'plain'
'mode' => 'popup', //mode: 'popup' or 'inline'
'defaults' => array( //default settings for all editable elements
'emptytext' => 'Click to edit'
)
));
Yii::app()->setComponent('editable',$component);
} Or in the config main.php 'editable' => array(
'class' => 'editable.EditableConfig',
'form' => 'bootstrap', //form style: 'bootstrap', 'jqueryui', 'plain'
'mode' => 'popup', //mode: 'popup' or 'inline'
'defaults' => array( //default settings for all editable elements
'emptytext' => 'Click to edit'
)
), |
@Julian-B90 Excellent, Thank you! |
Is setting emptytext for editableColumn possible?
I see it in the docs with "Click to Edit" but it seems using an override:
if($.fn.editable) $.extend($.fn.editable.defaults, {'emptytext':'Click to edit','mode':'popup'});
The text was updated successfully, but these errors were encountered: