Forum


09:07

30/07/2009

phicarre said:
I replied too quickly …
because now I cannot create a record …
In fact I must have two forms: one for the creation and one for the edition/modification.
Is it possible to have different forms ?
In that case you can set recreateForm true (so that the form gets rebuilt every time you click the add or edit buttons), and use onBeforeInit to set/clear the readonly attribute in the colModel.
Mark
09:07

30/07/2009

phicarre said:
I replied too quickly …
because now I cannot create a record …
In fact I must have two forms: one for the creation and one for the edition/modification.
Is it possible to have different forms ?
In that case you can set recreateForm true (so that the form gets rebuilt every time you click the add or edit buttons), and use onBeforeInit to set/clear the readonly attribute in the colModel.
Mark
10:36

09/11/2009

I think that my question is not well formulated or I didn't understand your answer.
(for set/clear attribute: ok)
I have a grid. When I click on one row, a form is displayed for modification/edit. In this case I protect one field with "readonly" as you suggested. I can change all fields excepted this one.
In the pager, I use the "+" for the creation. When I click on it, the same form is displayed BUT, in this case, I want to edit the field.
but it's impossible because of the "readonly" !
That's why I asked if we can have two forms !
11:33

30/07/2009

Yes. I understood your question.
Just before the form is created, the grid calls your onBeforeInit function (if you have one). You can supply one onBeforeInit function for add, and one onBeforeInit for edit.
Use the onBeforeInit functions to change the editoptions for the column in question (ie add or remove the readonly property from colModel).
You also need to set recreateForm to true, to ensure the form is rebuilt every time you call editGridRow (otherwise it just re-uses the previous form, with new values inserted, and wont call onBeforeInit, or look at your colModel options).
Mark
17:05

09/11/2009

Yeah !!!
One time in the navigator (add):
...
recreateForm:true,
beforeInitData: function (formid){jQuery("#list1").setColProp('nom', {editoptions:{readonly:false}}); } ,
...
One time in the Grid:
jQuery("#list1").editGridRow(gr,
{
...
recreateForm:true,
beforeInitData: function (formid){jQuery("#list1").setColProp('nom', {editoptions:{readonly:true}}); },
...
Very good analysis. very good exchange. better that "please consult the doc" ...
Most Users Ever Online: 715
Currently Online:
203 Guest(s)
Currently Browsing this Page:
1 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