我有一系列限制,以及启用/禁用限制的复选框.但是复选框不起作用
function Limit(start, end)
{
var that = this;
this.start = start;
this.end = end;
this.label = ko.computed(function(){
return that.start + ' - ' + that.end;
});
}
function ViewModel()
{
var that = this;
this.limits = [new Limit(1,2), new Limit(3,4), new Limit(4,5)];
this.activeLimit = ko.observable(that.limits[0]);
this.changeActiveLimit = function(limit)
{
that.activeLimit(limit);
}
}
ko.applyBindings(new ViewModel());?
Run Code Online (Sandbox Code Playgroud)
我的HTML
<div data-bind="foreach: {data: limits, as: 'limit'}">
<input type="checkbox" data-bind="click: $root.changeActiveLimit, checked: limit.label == $root.activeLimit().label"/>
<span data-bind="text: limit.label"/>
</div>
Run Code Online (Sandbox Code Playgroud) 我有这个布局:

我的CSS:
body {
background: #e2eaed;
}
a {
text-decoration: none;
color: #fff;
font-size: 30px;
height: 62px;
line-height: 62px;
/* vertical-align: middle is not works */
background: #8dc73f;
width: 132px;
padding: 0 25px;
font-size: 16px;
text-align: center;
font-weight: bold;
margin-left: 4px;
display: block;
float: left;
}
Run Code Online (Sandbox Code Playgroud)
当按钮有1行文本时,我的代码运行良好.但是当按钮有2行文本时,如上图所示.代码文本有很高的高度,因为我使用了line-height属性.我试过了vertical-align但是没有用.
请看jsfiddle.
我有一个模特:
class Service extends CActiveRecord
{
public static function model($className = __CLASS__)
{
return parent::model($className);
}
public static function getMainPageItems()
{
return self::model()->findAll(array(
'condition' => 'on_main = 1',
'order' => 'pos ASC'
));
public static function getNonMainPageItems()
{
return self::model()->findAll(array(
'condition' => 'on_main = 0',
'order' => 'pos ASC'
));
}
Run Code Online (Sandbox Code Playgroud)
我想将模型的默认顺序设置为pos ASC.
如何设置模型的默认顺序?
activerecord ×1
button ×1
criteria ×1
css ×1
javascript ×1
knockout-2.0 ×1
knockout.js ×1
php ×1
yii ×1