Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Dynamically adding Fields to the Edit Form
20/11/2008
05:54
Avatar
diptendu
Member
Members
Forum Posts: 17
Member Since:
21/10/2008
sp_UserOfflineSmall Offline

Hello,

How do I add fields (dropdown, text, file input, etc.) dynamically to the

Edit Form that created on the fly by JQGrid.

The Form Id is available on various events I know, but how do add fields to that form?

20/11/2008
06:35
Avatar
madkixt
Indonesian
Member
Members
Forum Posts: 3
Member Since:
20/11/2008
sp_UserOfflineSmall Offline

colModel:[ {name:'id',index:'id', width:55,editable:false,editoptions:{readonly:true,size:10}}, {name:'invdate',index:'invdate', width:80,editable:true,editoptions:{size:10}}, {name:'name',index:'name', width:90,editable:true,editoptions:{size:25}}, {name:'amount',index:'amount', width:60, align:"right",editable:true,editoptions:{size:10}}, {name:'tax',index:'tax', width:60, align:"right",editable:true,editoptions:{size:10}}, {name:'total',index:'total', width:60,align:"right",editable:true,editoptions:{size:10}}, {name:'closed',index:'closed',width:55,align:'center',editable:true,edittype:"checkbox",editoptions:{value:"Yes:No"}}, {name:'ship_via',index:'ship_via',width:70, editable: true,edittype:"select",editoptions:{value:"FE:FedEx;TN:TNT"}}, {name:'note',index:'note', width:100, sortable:false,editable: true,edittype:"textarea", editoptions:{rows:"2",cols:"20"}} ],

this select/dropdown

20/11/2008
07:01
Avatar
diptendu
Member
Members
Forum Posts: 17
Member Since:
21/10/2008
sp_UserOfflineSmall Offline

I want to add the fields DYNAMICALLY, i.e., after the

Edit Form is created.

20/11/2008
10:25
Avatar
madkixt
Indonesian
Member
Members
Forum Posts: 3
Member Since:
20/11/2008
sp_UserOfflineSmall Offline
24/11/2008
07:57
Avatar
diptendu
Member
Members
Forum Posts: 17
Member Since:
21/10/2008
sp_UserOfflineSmall Offline

Hello madkixt,

Thanks for the reference. However, I am looking for

a mechanism to ADD a completely new field (that is

NOT present in the column model) in the form when

the form opens.

Regards.

25/11/2008
01:35
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

It is a little difficult, but not impossible.

When you want to add fields? - everey time you open a form or

only once when is already created.

When once use onInitializeForm , when every time you can use

beforeShowForm

I will use onInitializeForm and suppose you want to add field

after the field “myfield”  from colModel which is editable

onInitializeForm : function (formid) {

var my_field_pos = $(”#myfield”,formid).parent(”tr:first”)

var elm = “<tr class=”FormData”>

<td class=”CaptionTD”>MyCaption</td>

<td class=”DataTD”><input class=”FormElement”…/></td>

</tr>

$(my_field_po).after(elm)

}

Regards

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.

03/09/2009
08:18
Avatar
sudeval
Brazil
Member
Members
Forum Posts: 5
Member Since:
03/09/2009
sp_UserOfflineSmall Offline

It´s possible replace the form that jqGrid create (add form, view form and edit form)?

03/09/2009
08:47
Avatar
Renso
PA
Member
Members
Forum Posts: 118
Member Since:
11/09/2008
sp_UserOfflineSmall Offline

Can you add all fields you may want to “add” by stipulating “hidden: true, hidedlg: true“, and when you want to show it after form has been initialized do :

$('#myGrid').setColProp('ship_via', { hidden: false; hidedlg: false; … });

Of course if you do not know what those field may be this would not work but I cannot imagine that being the case else how would you server-side code know what to return?

03/09/2009
09:55
Avatar
sudeval
Brazil
Member
Members
Forum Posts: 5
Member Since:
03/09/2009
sp_UserOfflineSmall Offline

i think that navButtonAdd can help me, because i create my form with my layout and especial validations.

thank´s

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
41 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.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information