0

以下のような jqxGrid があり、jqxGrid の文字数を制限したい。

columns : [ {
text :
‘Type’,datafield : ‘type’, width : 150, align : ‘center’,cellsalign : ‘left’, editable : false
}, {
text :
‘Phase’,datafield : ‘phase’, width : 150, align : ‘center’,cellsalign : ‘left’, editable : false
},{
text :
‘Phase Description’,datafield : ‘phaseDescription’, width : 150, align : ‘center’,cellsalign : ‘left’, editable : false
},{
text :
‘Custom Phase’, datafield : ‘customPhase’, width : 150, align : ‘center’, cellsalign : ‘left’
}

「カスタム フェーズ」列では、ユーザー エントリを 10 文字に制限する必要があります。それを達成する方法は?

4

2 に答える 2

0

列の「検証」機能のこのデモ使用: cellediting.htm

 validation: function(cell, value)
 {
    if (value.toString().length > 10)
    {
        return { result: false, message: "entered text should be less than 10 characters"}
    }
    return true;
 }

値は数値または日付オブジェクトになる可能性があるため、toString() が必要です。

于 2013-09-17T09:20:33.840 に答える