0

I am new to jqGrid, and having trouble with achieving a couple of tasks. Any guidance will be a huge help.

I need to have dynamically populated drop down list.

 $("#HEALTH_PLAN_CATEGORY_VALUE_ID").change(function () {            $.getJSON('/Ajax/GetCountyForHealthPlan', { id: $(this).val() }, function (counties) {                var ddlSelectedCounty = $("#COUNTY_GSA_LOOKUP_ID");

                // clear all previous options                $("#COUNTY_GSA_LOOKUP_ID > option").remove();

                // populate the products                for (i = 0; i < counties.length; i++) {

                    ddlSelectedCounty.append($("<option />").val(counties[i].Value).text(counties[i].Text));                }

            });

        });

Thanks a lot.

4

1 回答 1

1

如果您需要为某些列动态填写编辑表单的选择列表中的选项,您应该使用dataUrl从服务器获取数据buildSelect并将服务器响应转换为<select><option value='val'>Text</option>...</select>. 有关示例,请参见答案的“更新”部分。

于 2012-04-04T19:52:28.133 回答