Skip to content

Commit

Permalink
Dev: add tatableCellAdapters for admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Mar 19, 2013
1 parent c7dea7a commit ad5efd4
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion scripts/admin/admin_core.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
//$Id: admin_core.js 10154 2011-05-31 11:45:24Z c_schmitz $
/*
* JavaScript functions for LimeSurvey administrator
*
* This file is part of LimeSurvey
* Copyright (C) 2007-2013 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/


$(document).ready(function(){
initializeAjaxProgress();
tableCellAdapters();
if(typeof(userdateformat) !== 'undefined')
{
$(".popupdate").each(function(i,e) {
Expand Down Expand Up @@ -645,3 +659,24 @@ function initializeAjaxProgress()
$(this).dialog('close');
});
}

/**
* Adapt cell to have a click on cell do a click on input:radio or input:checkbox (if unique)
* Using delegate the can be outside document.ready
*/
function tableCellAdapters()
{
$('table').delegate('tbody td input:checkbox,tbody td input:radio,tbody td label,tbody th input:checkbox,tbody th input:radio,tbody th label',"click", function(e) {
e.stopPropagation();
});
$('table').delegate('tbody td,tbody th',"click", function() {
if($(this).find("input:radio,input:checkbox").length==1)
{
$(this).find("input:radio").click();
$(this).find("input:radio").triggerHandler("click");
$(this).find("input:checkbox").click();
$(this).find("input:checkbox").triggerHandler("click");
}
});
}

2 comments on commit ad5efd4

@c-schmitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shnoulle This commit seems to break the selection of multiple columns in jqGrid. jqGrid will always return "Please, select row" if any action on the selected columns is executed. I am not sure why we need this function in the administration but maybe we should limit it to tables that are marked by a certain class so it does not get in the way of jqGrid (or other specific table constructs)

@Shnoulle
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I add it for the right administration page. No label then click is more easy like this.

Can

  • Remove it
  • Limit to scpecifc class
  • All table except jqGrid (and some other css selector)

Your choice

Please sign in to comment.