我加载了一个带有数据库请求的网格(在PHP中使用CodeIgniter abd jqgrid helper).我没有任何问题来显示我的数据的漂亮网格.
我想显示一个带有复选框的新colomn,以便选择一行或多行.
加载后无法添加新列.所以我试着这样做: - 在创建网格时添加colomn, - 在创建时,我添加一个带有函数的'loadComplete'选项, - 在diplaying时,执行该函数.这里是 :
function ajoutCheckBox() {
var grille = $("#users_grid");
// Construire les checkbox dans la colonne D
grille.setColProp('Dest', {editable: true});
grille.setColProp('Dest', {edittype: 'checkbox'});
grille.setColProp('Dest', {editoptions: { value: "True:False" }});
grille.setColProp('Dest', {formatter: "checkbox"});
grille.setColProp('Dest', {formatoptions: { disabled: true}});
// Insérer la valeur false dans toutes les lignes de la colonne D
var index = grille.jqGrid('getGridParam', '_index');
for(i in index) {
grille.jqGrid('setCell', i, 'Dest', 'False', {});
}
}
Run Code Online (Sandbox Code Playgroud)
如您所见,gris称为"#users_grid",列为"Dest".
我的问题:没有什么附加......
谢谢您的帮助 …
我不明白javascript的行为.
我正在对jquery ui对话框进行表单验证.这似乎是一个javascript问题,而不是jquery问题.
对于验证,我为每个返回true或false的字段执行一个函数,一个布尔变量接收连续的&&运算符的结果.像这样 :
bValid = checkRegexp(validite, /^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/, "Entrez la date de validit\350 sous la forme JJ/MM/AAAA." );
bValid = bValid && checkLength(libelle, "Libell\351", 1, 100 );
bvalid = bValid && checkLength(description, "Description", 1, 250);
Run Code Online (Sandbox Code Playgroud)
以下是验证功能:
function checkLength( o, n, min, max ) {
if ( o.val().length > max || o.val().length < min ) {
o.addClass( "ui-state-error" );
if(o.val().length == 0) { textError = textError + "le champ " + n + " est requis !\n"; }
else { …Run Code Online (Sandbox Code Playgroud)