Forum


04:05

02/08/2008

Hi all,
I would like to have two different form to edit my grid.One to add rows and an other to edit row.
so I've made 2 functions
function edit(idSubGrid){
var id = jQuery("#"+idSubGrid).getGridParam('selrow');
if (id) {
var ret = $("#"+idSubGrid).getRowData(id);
$("#"+idSubGrid).setColProp('num',{editable:true});
$("#"+idSubGrid).setColProp('name',{editable:true});
$("#"+idSubGrid).setColProp('surname',{editable:false});
//on affiche le formulaire de modification
$("#"+idSubGrid).editGridRow(
ret.idPerson,
{
editCaption: "Edit a person",
reloadAfterSubmit:true,
closeAfterEdit:true,
height:310
}
);
} else {
alert("Please select row");
}
}
function add(idSubGrid){
//definition des données editbables
$("#"+idSubGrid).setColProp('surname',
{
editable:true,
});
$("#"+idSubGrid).setColProp('num',{editable:false});
$("#"+idSubGrid).setColProp('name',{editable:false});
$("#"+idSubGrid).setColProp('surname',{editable:true});
$("#"+idSubGrid).editGridRow(
"new",
{
addCaption: "Add a Person",
reloadAfterSubmit:true,
closeAfterEdit:true,
height:100
}
);
}
as you can see to edit a grid I want to set 2 fields (num & name) and to add a row i just need to set only one field (surname).
For the edit form I set the to columns I want to complete as 'editable' and the one I don't want to complete as 'non-editable'.
For tha add form I set the surname field as 'editable' and the other columns as 'non-editable'
So when I want to add something, it works I got a form with the field I want to complete.But if I want to edit something i got the same form instead of a form with 2 fields.
I wonder myself if the setColProp methods are working properly?
04:40

Moderators
30/10/2007

If you use jqGrid version 3.2.1 there was a bug in setColProp.
Switch to last one.
Reagrds
Tony
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
05:37

Moderators
30/10/2007

If this is the full code you have error in function add
function add(idSubGrid){
//definition des données editbables
$(”#”+idSubGrid).setColProp('surname',
{
editable:true,
});
...
For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.
Most Users Ever Online: 715
Currently Online:
74 Guest(s)
Top Posters:
OlegK: 1255
markw65: 179
kobruleht: 144
phicarre: 132
YamilBracho: 124
Renso: 118
Member Stats:
Guest Posters: 447
Members: 11373
Moderators: 2
Admins: 1
Forum Stats:
Groups: 1
Forums: 8
Topics: 10592
Posts: 31289
Newest Members:
, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.comModerators: tony: 7721, Rumen[Trirand]: 81
Administrators: admin: 66