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
Default Value in Add Form
20/08/2008
13:33
Avatar
Tommy1402
Member
Members
Forum Posts: 6
Member Since:
20/08/2008
sp_UserOfflineSmall Offline

Hi,

I use Master Detail demo. When the ParentGrid is selected, it changes the ChildGrid url.

jQuery("#list10_d").setGridParam({url:"subgrid.php?q=1&id="+ids,page:1})

Okay. I added an Edit and Add navGrid. Everything is fine actually. the Edit action is working and so is the Add action.

One thing I found in Add action is, the default value for all of the field is blank. Now, how can I add a custom default value for it? like when the Add button is pressed in the ChildGrid, the custom field value depends on the selected row in ParentGrid ? Maybe when the Add button is pressed, the default Item Name is the same with the selected row Client Name... something like that...

thanks for the help.

21/08/2008
00:19
Avatar
Tommy1402
Member
Members
Forum Posts: 6
Member Since:
20/08/2008
sp_UserOfflineSmall Offline

Well, I managed to solve it somehow. But, I don't know wether this solution is optimal or not.

here's the code:

onInitializeForm: function(formid) {
  var master_id = jQuery(gridInits[0].section).getGridParam('selrow');
  var masterdata = jQuery(gridInits[0].section).getRowData(master_id);
jQuery("#subject_id",formid).attr("value",masterdata.subject_id);}

First I use: 

jQuery("#subject_id", formid).value(masterdata.subject_id);

But not working.

21/08/2008
02:45
Avatar
tony
Sofia, Bulgaria
Moderator
Members

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

If you use navigator in add option use beforeShowForm event

something like this:

beforeShowForm : function(form_id) {

if(some_condition) {

jQuery(”#name_from_colmodel”,formid).val(”myvalue”);

}

}

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.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
79 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