E
E
Eugene2017-04-13 11:05:45
JavaScript
Eugene, 2017-04-13 11:05:45

How to remake the delete fields function so that all but one field would be deleted?

There is a function that removes the fields for the filter.

function deleteFilter(el)
{
    BX.adminPanel.showWait(el);
    if (0 < arClearHiddenFields.length)
    {
        for (var index = 0; index < arClearHiddenFields.length; index++)
        {
            if (undefined != window[arClearHiddenFields[index]])
            {
                if ('ClearForm' in window[arClearHiddenFields[index]])
                {
                    window[arClearHiddenFields[index]].ClearForm();
                }
            }
        }
    }
<?=$sTableID."_filter"?>.OnClear('<?=CUtil::JSEscape($sTableID)?>', '<?=CUtil::JSEscape($APPLICATION->GetCurPage().'?type='.urlencode($type).'&IBLOCK_ID='.$IBLOCK_ID.'&lang='.LANGUAGE_ID.'&')?>');
  return false;

How to delete all fields except one?
what I could do doesn't work:
function deleteFilter(el)
{
  BX.adminPanel.showWait(el);
  if (0 < arClearHiddenFields.length)
  {
    for (var index = 0; index < arClearHiddenFields.length; index++)
    {
      if (undefined != window[arClearHiddenFields[index]])
      {
                  if ('IBLIST_A_F_CREATED_BY' == arClearHiddenFields[index]) {
                  continue;
}
          if ('ClearForm' in window[arClearHiddenFields[index]])
        {
          window[arClearHiddenFields[index]].ClearForm();
        }
      }
    }
  }
  <?=$sTableID."_filter"?>.OnClear('<?=CUtil::JSEscape($sTableID)?>', '<?=CUtil::JSEscape($APPLICATION->GetCurPage().'?type='.urlencode($type).'&IBLOCK_ID='.$IBLOCK_ID.'&lang='.LANGUAGE_ID.'&')?>');
  return false;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question