Javascript jqGrid基于以前的选择填充选择选项

Javascript jqGrid基于以前的选择填充选择选项,javascript,jquery,jqgrid,Javascript,Jquery,Jqgrid,下面是我用来创建jqGrid的代码片段- $("#list").jqGrid({ url:'products.php?storeId=<?php echo $_SESSION["valid_store"]; ?>', datatype: 'xml', mtype: 'GET', colNames:['Product Id','Product Description','Department','Category','Price','Sale Price

下面是我用来创建jqGrid的代码片段-

$("#list").jqGrid({
    url:'products.php?storeId=<?php echo $_SESSION["valid_store"]; ?>',
    datatype: 'xml',
    mtype: 'GET',
    colNames:['Product Id','Product Description','Department','Category','Price','Sale Price','Quantity','Extended Description','Image'],
    colModel :[ 
      {name:'ProductId', index:'ProductId', width:20}, 
      {name:'product_name', index:'product_name', width:50, editable:true, edittype:'text', search:true, stype:'text'},
      {name:'DepartmentName', index:'DepartmentName', width:40,sortable: false, editable: true, edittype: "select"},
      {name:'CategoryName', index:'CategoryName', width:40,sortable:false, editable:true, edittype:'select'},
当网格已加载时,我使用以下命令动态填充DepartmentName-

var departments = $.ajax({
        url: "get_departments.php?storeId=<?php echo $_SESSION["valid_store"]; ?>",
        async: false,
        success:function(data, result){
            if(!result){
                alert("Failure to retrieve the Departments");
            }
        }

loadComplete:function(){
        $("#list").setColProp('DepartmentName', { editoptions: { value: departments} });
    },
基本上,我将大量部门分配为JSON格式,当网格加载后,DepartmentName将填充所有这些部门。这一切都很好

我在做什么/理解什么方面有困难。现在,我有了这些值,这取决于我从Select中选择的部门,正在用所述部门引用的类别填充CategoryName。数据之间的关系已经在MySQL中设置好了


谢谢

使用另一个ajax功能。只需发送选择列表的值,并获取与该选择值关联的sql值。然后返回该选项,并在下一个选择项中仅显示这些选项。大概是这样的:

$.ajax({
   url:blah.html,
   data:{'something':'your select value'},
   success:function(data){$('#yourNextSelectItem').html(data)}
});

我不明白这个问题……基本上,我如何根据我在上一个选择下拉列表中所做的选择填充选择下拉列表