Forum
Not sure if anyone else has this issue, when I use the GridToForm option, all the textboxes are populated correctly with data from the grid, but my drop down boxes remain untouched, does jqGrid's GridToForm support that?
{ name: 'ParkAndInfluenceTypeDTO', index: 'ParkAndInfluenceTypeDTO', width: 100, editable: true, sortable: true, align: "left", resizable: true, edittype: "select", editoptions: { value: allParkAndInfluenceTypes }, editrules: { required: true }, search: true },
{ name: 'VOUrl', index: 'VOUrl', width: 155, editable: true, sortable: true, align: "left", resizable: true, edittype: "select", editoptions: { value: allVOs }, search: true },
{ name: 'ObjectionUrl', index: 'ObjectionUrl', width: 155, editable: true, sortable: true, align: "left", resizable: true, edittype: "select", editoptions: { value: allObjections }, search: true },
onSelectRow: function(rowId) {
var gridSelRow = $(item).getGridParam('selrow');
if (gridSelRow) {
$(item).GridToForm(gridSelRow, '#ParkAndInfluencActionsDetails');
}
},
<label class="required" for="ParkAndInfluenceTypeDTO">P&I Type :</label>
<span class="mvcWrapper required"><select name="ParkAndInfluenceTypeDTO" id="ParkAndInfluenceTypeDTO" class="required"><option value="17″>Create/Maintain Perception</option>
<option value="16″>Help overcome a specific Objection</option>
<option value="15″>Help with a specific VO</option>
<option value="19″>Other</option>
<option value="18″>Plan to Deliver Value</option>
</select></span>
<br>
<label class="" for="VOUrl">VO :</label>
<span class="mvcWrapper"><select name="VOUrl" id="VOUrl"><option value="">…</option>
<option value="374″>some VO comment</option>
<option value="507″>another VO comment</option>
</select></span>
<br>
<label class="" for="ObjectionUrl">Objection :</label>
<span class="mvcWrapper"><select name="ObjectionUrl" id="ObjectionUrl"><option value="">…</option>
<option value="300″>some objection</option>
<option value="188″>another objection</option>
11:20
Moderators
30/10/2007
Hello,
The problem here is that getRowData used in this case will return the text and not the value. One possible solution is to set for these fields formatter:"select". In this case getRowData will retun the value and not the text.
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.
Thanks for the tip Tony. With this the value will show up in stead of the text in the grid, so for example <option value="300″>some objection</option> will show "300" whereas I want the user to see the text value. BTW, I am using version 3.4. Does this mean I must create 2 versions of the column, 1 for viewing that simply has the text value, and another hidden that contains the key value - "300" in this example - that will populate the from drop down correctly?
Here is the solution:
Domain Model properties (C#):
{
get { return _objection != null ? _objection.Description : ""; }
}
public string ObjectionDTO
{
get { return _objection != null ? _objection.Id.ToString() : "0"; }
}
colModel:
{ name: 'ObjectionDTO', index: 'ObjectionDTO', hidden: true, edittype: 'select', editoptions: { value: allObjections} },
Of course the issue is that when using formatter: 'select' you must display the value and not the text, which is not what I want, therefore the solution recommended here is the only one I know, please advise. When I specify the following, is does not work and doeas not select the corresponding option from the ObjectionDTO select drop down box:
Also, since I am using toolbar filtering, using my recomendation is an issue as in stead of drop down boxes for the filters it gives me text boxes to represent as in this example the ObjectionDescription property, which again is not what I want. Tony, seems like a catch 22 here. I don't understand why the formatter: 'select' does not work properly and why I have to display the value and not the text in the grid for it to work. Again, I am using version 3.4
11:13
Moderators
30/10/2007
Hello,
Sorry to say, but version 3.4 is not supported from our team.
Kind Regard
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.
Most Users Ever Online: 715
Currently Online:
35 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