Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.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
Search 筛选新的customfield Phreeze_Search_Filter_Phreeze - Fatal编程技术网

Search 筛选新的customfield Phreeze

Search 筛选新的customfield Phreeze,search,filter,phreeze,Search,Filter,Phreeze,我正在使用创建一个应用程序。 一切正常,但当我想在模板中筛选自定义字段tagtypeName时,它不会这样做 我在model.js中有模型: model.TagModel = Backbone.Model.extend({ urlRoot: 'api/tag', idAttribute: 'id', id: '', name: '', type: '', TagtypeName: '', baja: '', defaults: {

我正在使用创建一个应用程序。 一切正常,但当我想在模板中筛选自定义字段tagtypeName时,它不会这样做

我在model.js中有模型:

model.TagModel = Backbone.Model.extend({
    urlRoot: 'api/tag',
    idAttribute: 'id',
    id: '',
    name: '',
    type: '',
    TagtypeName: '',
    baja: '',
    defaults: {
        'id': null,
        'name': '',
        'type': '',
        'baja': ''
    }
});
我的标准是TagCriteria.php:

public function GetFieldFromProp($propname)
    {
        switch($propname)
        {
            case 'TagtypeName':
                return 'tagtype.id';
            case 'Id':
                return 'tag.id';    
            case 'Name':
                return 'tag.name';
            case 'Type':
                return 'tag.type';
            case 'Baja':
                return 'tag.baja';  
            default:
                return parent::GetFieldFromProp($propname);
                //throw new Exception('Unable to locate the database column for the property: ' . $propname);
        }
    }
我的记者是: 公费$Id; 公共名称; 公共$类型; 公费$巴哈; public$TagtypeName

/*
* GetCustomQuery returns a fully formed SQL statement.  The result columns
* must match with the properties of this reporter object.
*
* @see Reporter::GetCustomQuery
* @param Criteria $criteria
* @return string SQL statement
*/
static function GetCustomQuery($criteria)
{
    $sql = "select
        `tagtype`.`name` as TagtypeName
        ,`tag`.`id` as Id
        ,`tag`.`name` as Name
        ,`tag`.`type` as Type
        ,`tag`.`baja` as Baja
    from `tag`
    inner join `tagtype` on `tagtype`.`id`=`tag`.`type`";

    // the criteria can be used or you can write your own custom logic.
    // be sure to escape any user input with $criteria->Escape()
    $sql .= $criteria->GetWhere();
    $sql .= $criteria->GetOrder();

    return $sql;
}
该观点有:

        <script type="text/template" id="tagCollectionTemplate">
            <table class="collection table table-bordered table-hover">
            <thead>
                <tr>
                    <th id="header_Id">Id<% if (page.orderBy == 'Id') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>
                    <th id="header_Name">Name<% if (page.orderBy == 'Name') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>
                    <!--<th id="header_Type">Type<% if (page.orderBy == 'Type') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>-->
                    <th id="header_Type">Type<% if (page.orderBy == 'TagtypeName') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>
                    <th id="header_Baja">Baja<% if (page.orderBy == 'Baja') { %> <i class='icon-arrow-<%= page.orderDesc ? 'up' : 'down' %>' /><% } %></th>
                </tr>
            </thead>
            <tbody>
            <% items.each(function(item) { %>
                <tr id="<%= _.escape(item.get('id')) %>">
                    <td><%= _.escape(item.get('id') || '') %></td>
                    <td><%= _.escape(item.get('name') || '') %></td>
                    <!--<td><%= _.escape(item.get('type') || '') %></td>-->
                    <td><%= _.escape(item.get('tagtypeName') || '') %></td>
                    <td><%= _.escape(item.get('baja') || '') %></td>
                </tr>
            <% }); %>
            </tbody>
            </table>

            <%=  view.getPaginationHtml(page) %>
        </script>
因此,当我转到页面时,我看到的是表,而不是类型id,它根据需要具有来自custome查询的类型名称

但当我筛选时,找不到具有新自定义字段的数据:


有人知道如何处理这个问题吗?

问题是我必须更改报告器计数并放入内部联接:

static function GetCustomCountQuery($criteria)
    {
        $sql = "select count(1) as counter from `tag`
        inner join `tagtype` on `tagtype`.`id`=`tag`.`type`";

        // the criteria can be used or you can write your own custom logic.
        // be sure to escape any user input with $criteria->Escape()
        $sql .= $criteria->GetWhere();

        return $sql;
    }
这样做对我来说没问题

static function GetCustomCountQuery($criteria)
    {
        $sql = "select count(1) as counter from `tag`
        inner join `tagtype` on `tagtype`.`id`=`tag`.`type`";

        // the criteria can be used or you can write your own custom logic.
        // be sure to escape any user input with $criteria->Escape()
        $sql .= $criteria->GetWhere();

        return $sql;
    }