[ZBX-6663] select all checkbox lost selected state when switch between items in page (items view) Created: 2013 Jun 05  Updated: 2017 May 30  Resolved: 2013 Sep 09

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.0.6, 2.1.0
Fix Version/s: 2.1.1, 2.1.2, 2.2.0

Type: Incident report Priority: Trivial
Reporter: jabalv Assignee: Ivo Kurzemnieks
Resolution: Fixed Votes: 0
Labels: configuration, items
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBX-4132 Combobox cookie not removed when dele... Closed

 Description   

If check box "Select all" is active, when switch to next items and then back to previous then items still remains selected, but "Select all" check box not. Minor issue.



 Comments   
Comment by Alexander Vladishev [ 2013 Jun 13 ]

Similar issue:

Selected applications/items/triggers/graphs stay remembered if click on a parent template (in the list).

iivs In order to fix this properly, ZBX-6732 should be fixied prior to this.

Comment by Ivo Kurzemnieks [ 2013 Jul 03 ]

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-6663

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 05 ]

(1.1) Function resetCurrentPageCookies() is good and must be united with code in every configuration page, like this:

if ($_REQUEST['go'] != 'none' && !empty($go_result)) {
	$url = new CUrl();
	$path = $url->getPath();
	insert_js('cookie.eraseArray("'.$path.'")');
}

(1.2) Variables names in resetCurrentPageCookies() must be in camelCase ("$hostid" => "$hostId")
(1.3) Function can be renamed to "resetPageCookies()" it will be more clear.

iivs
Due to changes proposed in (9), this function is now removed.

RESOLVED in r36858

Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 05 ]

(2) JS error in dashboard:
Uncaught TypeError: Cannot read property 'length' of undefined chkbxRange.allSelected

iivs RESOLVED in r36836
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 05 ]

(3.1) CamelCase must to be used in allSelected() function validable names.
(3.2) Suggest to rename "allSelected()" to "selectMainCheckbox()" or something better for clear understanding..

iivs RESOLVED in r36845
Eduards REOPEN, Good! but in selectMainCheckbox() line can be optimized from

mainCheckbox.checked = (countChecked == countAvailable) ? true : false;

to simple

mainCheckbox.checked = (countChecked == countAvailable);

iivs RESOLVED in r36891
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 05 ]

(4) Undefined index: hostid [ in /home/zabbix/www/testing-ZBX-6663/frontends/php/triggers.php:114]

iivs
Due to removal of function, the error should no longer appear.

RESOLVED in r36858

Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 05 ]

(5) jQuery.inArray() can be used instead of new in_array()

iivs
Note:
jQuery.inArray() works differently from in_array() function. New JS function in_array() works similarly how PHP does, it accepts associated arrays as well as indexed arrays, where apparently jQuery.inArray() accepts only indexed arrays.
jQuery.inArray() returned -1, where in_array() returned true.

This function was not required and is now removed.

RESOLVED in r36836

Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 05 ]

(6) If user select manually all checkboxes, main checkbox become also checked - it's ok. But if user uncheck some items, main checkbox still stay checked.

iivs RESOLVED in r36836

Eduards CLOSED

Comment by Ivo Kurzemnieks [ 2013 Jul 05 ]

(7) If item list contains LLD items, checkboxes are marked as disabled. Those checkboxes are also taken into account when checking for all marked checkboxes, but shouldn't.

iivs RESOLVED in 36836
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 05 ]

(8) Function eraseArrayByPattern() in class.cookie.js can be deleted.

iivs RESOLVED in r36836
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 05 ]

(9) Suggest not used "referid" parameter but try to implement parent id as prefix in cookie, to automatically clean unwanted cookies.

iivs RESOLVED in r36858
Eduards CLOSED

Comment by Ivo Kurzemnieks [ 2013 Jul 09 ]

(10) Checkbox range selection (holding Shift or Ctrl key) also selects disabled checkboxes.

iivs RESOLVED in r36845
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 10 ]

(11) Links with 1 or 2 parameters better to write in one line, because it's hard to read 6 lines instead of 1.

$name[] = new CLink(
    $template['name'],
    'applications.php?'.
        'hostid='.$template['hostid'],
    'unknown'
);

iivs RESOLVED in r36891
Eduards CLOSED, Perfect!

Comment by Ivo Kurzemnieks [ 2013 Jul 10 ]

(12) Move "prefix" at the end of path like:

cb_/zabbix/frontends/php/items.php_10991_parts

iivs After discussion with Pavel, decided that path cookie name is now redundant and cookie name could be like this:

cb_items_10991_parts

RESOLVED in r36891
Eduards CLOSED, Super!

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 10 ]

(13) Incorrect selected GO count in event when all items in page is LLD or disabled.

iivs RESOLVED in r36891
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 10 ]

(14) Main checkbox in checked state must add "selectedMain" class to it <TR>. It's need for Selenium automatic testing.

iivs RESOLVED in r36891
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 11 ]

(15) Incorrect GO count in Monitoring->Triggers after filtering.

iivs Cookies for checkboxes are now reset after filtering.

RESOLVED in r36922

Eduards CLOSED

Comment by Ivo Kurzemnieks [ 2013 Jul 12 ]

(16) Cookie deletion with cookie.eraseArray broke during recent changes. While fixing this, would be good to unify coding style for

$go_result => $goResult

.

iivs RESOLVED in r36922

Eduards REOPEN, please group filter lines in forms.inc.php:623-630

$filter = new CButton('filter', _('Filter'),
    "javascript: create_var('zbx_filter', 'filter_set', '1', true); chkbxRange.clearSelectedOnFilterChange();"
);

$reset = new CButton('reset', _('Reset'), "javascript: clearAllForm('zbx_filter');");
$reset->useJQueryStyle();

$filter->useJQueryStyle('main');

iivs RESOLVED in r36957
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 12 ]

(17) Undefined variable: existGroups [ in /home/zabbix/www/testing-ZBX-6663/frontends/php/hosts.php:335]

iivs RESOLVED in r36957
Eduards CLOSED, Good!

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 12 ]

(18) Require clean checkboxes after every operation, as discussed.

iivs
Added checkbox cookie resetting after operations "save", "delete", "massupdate", "enable", "disable", but avoided inner actions in case presses "cancel". There's a small twist: if inner action includes adding an element from pop-up, it will erase previous list if checkbox cookies, making new cookie with name "cb_popup_parts". This functionality already existed.

RESOLVED in r36957

Eduards REOPEN

  • This code must be formatted from
    /**
     * clear page cookies on action
     *
     * @param bool $goResult
     * @param int $id
     */
    function clearCookies($goResult = false, $id = null) {
    	if (!empty($goResult)) {
    		$url = new CUrl();
    		$path = $url->getPath();
    		insert_js('cookie.eraseArray("'.basename($path, '.php').(empty($id) ? '' : '_'.$id).'")');
    	}
    }
    

to something like:

/**
 * clear page cookies on action.
 *
 * @param bool   $clean
 * @param string $id        parent id, is used as cookie prefix
 */
function clearCookies($clean = false, $id = null) {
	if ($clean) {
		$url = new CUrl();

		insert_js('cookie.eraseArray("'.basename($url->getPath(), '.php').($id ? '_'.$id : '').'")');
	}
}

iivs RESOLVED in r37075
Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 17 ]

Tested!

Comment by Ivo Kurzemnieks [ 2013 Jul 17 ]

Fixed in pre-2.1.1 (trunk) r37084

Comment by Egita Sidorova (Inactive) [ 2013 Jul 22 ]

(19) mass select function not working for configuration- web scenarios, both hosts and templates page

iivs RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-6663 r37247

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Jul 24 ]

(20) When deleting a graph from the form an error is displayed:

Undefined index: hostid [ in /opt/lampp/htdocs/zabbix/trunk/frontends/php/graphs.php:260]

iivs RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-6663 r37349

jelisejev CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Aug 07 ]

TESTED.

Comment by Ivo Kurzemnieks [ 2013 Aug 07 ]

Fixed in pre-2.1.2 (trunk) r37640

Comment by richlv [ 2013 Aug 20 ]

(21) this apparently changed the functionality of the action dropdown and the 'go' button when no entities are selected.
a) this is not mentioned in the changelog
b) this is not mentioned in whatsnew

(i also don't see it even mentioned on this issue, but i might be missing it...)

please, let's not have functional changes without any information

iivs Changelog updated in 2.1.5 (trunk) r38352, r38353
Documentation updated https://www.zabbix.com/documentation/2.2/manual/introduction/whatsnew220?do=diff&rev2[0]=1378213474&rev2[1]=
Please, review.

<richlv> minor changes -> CLOSED

Comment by richlv [ 2013 Aug 30 ]

this resulted in a regression : ZBX-6938

Generated at Sun Jun 22 07:31:10 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.