AngularJs搜索多个文本框和ng-grid上的下拉列表 [英] AngularJs Search on Multiple textboxes and dropdowns on ng-grid

查看:260
本文介绍了AngularJs搜索多个文本框和ng-grid上的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我使用的是MVC 5.0,AngularJs和Entityframework。我正在使用ng-grid,它显示所需的所有数据并在下面给出



OID ONAME DES DDATE IDATE OSTATUS OItemID



1666 Seeta测试2014年6月26日,2014年6月27日2014年6月22日新4





我想制作搜索此网格上的每个字段。请帮我修改AngularJS中的代码。我可以使用AngularJs过滤器搜索OID,但是相同的概念不适用于其他字段。请参阅以下用于创建api URL的代码。



Hi,

I am using MVC 5.0, AngularJs and Entityframework. I am using ng-grid and that is displaying all the data as required and given below

OID ONAME DES DDATE IDATE OSTATUS OItemID

1666 Seeta test 26 June 2014, 27 June 2014 22 June 2014 NEW 4


I want to make search on each filed on this grid. Please help me to correct code for this in AngularJS. I am able to search on OID using AngularJs filters however same concept is not working for another fields. Please see the below code which I am using to create api URL.

var apiUrl = '/api/SearchSvc?';

            if ($scope.Search.OID.length > 0) {
                apiUrl += "$filter=substringof('" + $scope.Search.OID + "', OID) ";
            }


            if ($scope.Search.ONAME.length > 0) {

                apiUrl += "and substringof('" + $scope.Search.ONAME + "', ONAME) ";
            }

            if ($scope.Search.DES.length > 0) {
                apiUrl += "and substringof('" + $scope.Search.DES + "', DES) ";
            }


Above grid I am displaying  search form which is having all the textboxes dropdown and calender control in csthml page for above given fields.

Please advice how to use filter for Integer type as well as Date type.

Thanks & Regards,
Care Career

推荐答案

scope.Search.OID.length > ; 0 ){
apiUrl + =
scope.Search.OID.length > 0) { apiUrl += "


filter = substringof(' +
filter=substringof('" +


scope.Search.OID + ',OID);
}


如果
scope.Search.OID + "', OID) "; } if (


这篇关于AngularJs搜索多个文本框和ng-grid上的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆