Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何根据其他列表布尔字段(查找值)在dropDownList字段中显示/隐藏数据_List_Sharepoint 2013_Lookup - Fatal编程技术网

如何根据其他列表布尔字段(查找值)在dropDownList字段中显示/隐藏数据

如何根据其他列表布尔字段(查找值)在dropDownList字段中显示/隐藏数据,list,sharepoint-2013,lookup,List,Sharepoint 2013,Lookup,我正在使用sharepoint 2013。。。 我有两份清单 1°/汽车{品牌、颜色、价格} 2°/颜色{名称、可用性} 我将字段“color”(汽车列表的字段)作为查找字段来显示颜色列表中的颜色。 在汽车列表中填写数据时,在颜色字段中,我只想在颜色列表的可用性字段中找到可用性为“是”的颜色。 我怎样才能得到这个 有人能帮我吗? 提前感谢。在您的车辆列表上创建一个新视图。然后过滤,这样它只显示可用性=yes的项目,我猜第二个列表有{颜色,名称,可用性}。 有两种解决方案: 第一个解决方案位于第二

我正在使用sharepoint 2013。。。 我有两份清单

1°/
汽车{品牌、颜色、价格}
2°/
颜色{名称、可用性
}

我将字段“color”(汽车列表的字段)作为查找字段来显示颜色列表中的颜色。 在汽车列表中填写数据时,在颜色字段中,我只想在颜色列表的可用性字段中找到可用性为“是”的颜色。 我怎样才能得到这个

有人能帮我吗?
提前感谢。

在您的车辆列表上创建一个新视图。然后过滤,这样它只显示可用性=yes的项目,我猜第二个列表有{颜色,名称,可用性}。 有两种解决方案: 第一个解决方案位于第二个列表中,您可以添加一个计算字段,该字段=if Availability=true:[带颜色的字段]:“”。这将过滤掉所有不可用的颜色。然而,当从可用更改为不可用时,您应该有一个问题,即您将丢失以前记录上的信息

第二个解决方案需要jquery和ajax。基本上,在加载文档时,您会检查每个选项是否可用,如果不可用,请将其删除。唯一的缺点是您需要jquery.js的某个地方,我在家里,但如果您需要,我可以明天编写代码。 代码是:

$(window).ready(function() { 
$("#PutHereTHeIDOfthedropodown > option").each(
function(index) {
                if (window.console) console.log("inside" + index+"," + $(this).val()); //39, 51 κλπ
                // $(this).hide();// with this, we hide the selection!!
                var mythis = $(this);
                $.ajax( {
                    url:"http://YourWebSite/sites/DNY/_api/Lists(guid'b5910edd-8a39-4d45-GUID-Of-The-List')/items(" + mythis.val()+")?$select=Active",
                    type:"GET",
                     headers: {
                        "accept": "application/json;odata=verbose",
                    },
                  success: function(data){ console.log("ajax call SUCCESS");  
                                       console.log("item:"+mythis.val());
                                            console.log("Data:" + data);
                                            console.log("Active: " + data.d.Active);
                                        if (!data.d.Active) {
                                            console.log("hiding: " + mythis.val() + "["+ "]");
                                            mythis.hide();
                        }//if
                }//success
                    ,
                    error: function(error){
                                           console.log(" =============================================>>Error:" + mythis.val());
                                           console.log (JSON.stringify(error));
                                           console.log(" Error:" + mythis.val());
                                           console.log(JSON.stringify(error));
                            }//error
                    });//ajax
                });//each
            });//ready

如果你能写一些代码那就太好了!!谢谢,我做完了。我是javascript/jquery的新手,但我觉得代码很简单,只需要更改参数。首先,尝试行“(“+mythis.val()+”?$select=Active”。Active是告诉我它是否处于活动状态的字段(是/否)字段类型。