我在我的项目中使用bootstrap,我想要一个单选按钮设置如下link。
<?php $radio = $this->beginWidget('zii.widgets.jui.CJuiButton', array(
'name'=>'checkbox-btn',
'buttonType'=>'buttonset',
'htmlTag'=>'span',
)); ?>
<input type="checkbox" id="check1" value="1" /><label for="check1">Checkbox 1</label>
<input type="checkbox" id="check2" value="2" /><label for="check2">Checkbox 2</label>
<input type="checkbox" id="check3" value="3" /><label for="check3">Checkbox 3</label>
<?php $this->endWidget();?>
但这似乎不起作用,它呈现像普通的radioButtonList不确定的表情符号 我在yiistrap,yiiwheels,zii和yiibooster中搜索过,找不到类似于“radios as buttons”的小部件。 我应该为此包含jquery ui吗?我更喜欢使用现有的小部件。 有什么建议吗?
答案 0 :(得分:0)
这是一个有点重的html部分,但有诀窍:
<script src="http://demo.bsourcecode.com/yiiframework/assets/7c93f9e4/jui/js/jquery-ui.min.js"></script>
<link href="http://demo.bsourcecode.com/yiiframework/assets/7c93f9e4/jui/css/base/jquery-ui.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="radio-btn" name="radio-btn" class="ui-buttonset">
<input type="radio" id="radio1" name="radio" value="1" class="ui-helper-hidden-accessible">
<label for="radio1" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-left" role="button" aria-disabled="false"><span class="ui-button-text">Choice 1</span>
</label>
<input type="radio" id="radio2" name="radio" value="2" class="ui-helper-hidden-accessible">
<label for="radio2" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-left" role="button" aria-disabled="false"><span class="ui-button-text">Choice 2</span>
</label>
<input type="radio" id="radio3" name="radio" value="3" class="ui-helper-hidden-accessible">
<label for="radio3" aria-pressed="false" class="ui-button ui-widget ui-state-default ui-button-text-only ui-corner-right" role="button" aria-disabled="false"><span class="ui-button-text">Choice 3</span>
</label>
</div>
&#13;
app.post('/doneList/:id',function(req, res){
var id = mongojs.ObjectId(req.params.id);
var oneTodo;
db.todoList.findOne({_id: id},function(err,docs){
db.doneList.insert(docs,function(err,doc){
res.json(doc);
db.todoList.remove({_id: id});
});
});
});
&#13;