R
R
Roman2019-05-21 10:52:20
1C-Bitrix
Roman, 2019-05-21 10:52:20

How to bind bitrix:main.ui.filter to a specific infoblock?

Hello.
Created a new infoblock for publishing documents.
I wanted to know how to bind the bitrix:main.ui.filter component to it? And then I started to prescribe type parameters (for example, for the time being, I just started working with this component, so I don’t understand much )

$APPLICATION->IncludeComponent(
    'bitrix:main.ui.filter', '',
    [
        'FILTER_ID' => 'roster_list',
        'GRID_ID' => 'roster_list',
        'FILTER' => [
            'id' => 'DOCUMENT_TYPE',
            'name' => 'Тип документа',
            'type' => 'list',
            'items' => []
        ],
        'ENABLE_LIVE_SEARCH' => TRUE,
        'ENABLE_LABEL' => TRUE
    ]
);

and as a result I got this:
5ce3ae0774d05381995862.png
And where to place it so that it is displayed above the main workspace (as in CRM, tasks, etc.)? And then when I place it on the page itself or in the template, it simply merges with the page.
And when the elements of the infoblock appear, they just move to the side
5ce3b21ede3a9687706303.png
. Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Panteleev, 2019-05-21
@s_panteleev

To begin with, 'FILTER' => []there should be an array of arrays (now you just have an array)
Look at the article - it describes connection examples.
The link with the infoblock will need to be implemented by code.
To add a filter above the workspace, try wrapping CBitrixComponentTemplate::SetViewTarget in the component template

<?php
// например, в /local/components/company/report.list/templates/.default/template.php

$this->SetViewTarget('inside_pagetitle');

$APPLICATION->IncludeComponent('bitrix:main.ui.filter', '', [ 
    'FILTER_ID' => 'report_list', 
    'GRID_ID' => 'report_list', 
    'FILTER' => [ 
        ['id' => 'IS_SPEND', 'name' => 'Тип операции', 'type' => 'list', 'items' => ['' => 'Любой', 'P' => 'Поступление', 'M' => 'Списание'], 'params' => ['multiple' => 'Y']],
    ], 
    'ENABLE_LIVE_SEARCH' => true, 
    'ENABLE_LABEL' => true 
]);

$this->EndViewTarget();?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question