newbie27
asked on
how to call these two functions
Hello Experts,
I have these two functions on the checkbox I am using in the attached function.
if(listID)=="#listDisplay"
{display: '<input type="checkbox" name="chkAll" onclick="checkAllDefault(t his.checke d)"/> All', width : 30},
else
{display: '<input type="checkbox" name="chkAll" onclick="checkAllDynamic(t his.checke d)"/> All', width : 30},
I have tried to do a check and apply the checkbox to the listViewer function but it did not work.
Please can you help.
Thanks
S
I have these two functions on the checkbox I am using in the attached function.
if(listID)=="#listDisplay"
{display: '<input type="checkbox" name="chkAll" onclick="checkAllDefault(t
else
{display: '<input type="checkbox" name="chkAll" onclick="checkAllDynamic(t
I have tried to do a check and apply the checkbox to the listViewer function but it did not work.
Please can you help.
Thanks
S
Try having a single function that takes an id parameter:
function checkAll(id )
{
$( id +" > tbody > tr > td > div > input.chkRefNos").each(fun ction(){
this.checked = chkd;
});
}
and then your checkboxes would be:
if(listID)=="#listDisplay"
{display: '<input type="checkbox" name="chkAll" onclick="checkAll(\'#listD isplay\')" /> All', width : 30},
else
{display: '<input type="checkbox" name="chkAll" onclick="checkAll(\'#listD isplay1\') "/> All', width : 30},
function checkAll(id )
{
$( id +" > tbody > tr > td > div > input.chkRefNos").each(fun
this.checked = chkd;
});
}
and then your checkboxes would be:
if(listID)=="#listDisplay"
{display: '<input type="checkbox" name="chkAll" onclick="checkAll(\'#listD
else
{display: '<input type="checkbox" name="chkAll" onclick="checkAll(\'#listD
ASKER
I am getting syntax error here Hielo.
if(listID)=="#listDisplay" ---> this line
{display: '<input type="checkbox" name="chkAll" onclick="checkAll(\'#listD isplay\')" /> All', width : 30},
else
{display: '<input type="checkbox" name="chkAll" onclick="checkAll(\'#listD isplay1\') "/> All', width : 30},
if(listID)=="#listDisplay"
{display: '<input type="checkbox" name="chkAll" onclick="checkAll(\'#listD
else
{display: '<input type="checkbox" name="chkAll" onclick="checkAll(\'#listD
syntax error
[Break on this error] if(listID)=="#listDisplay"\n
instead of \' use '
if(listID)=="#listDisplay" ---> this line
{display: '<input type="checkbox" name="chkAll" onclick="checkAll('#li stDisplay& #39;)"/> All', width : 30},
else
{display: '<input type="checkbox" name="chkAll" onclick="checkAll('#li stDisplay1 ')"/> All', width : 30},
if(listID)=="#listDisplay"
{display: '<input type="checkbox" name="chkAll" onclick="checkAll('#li
else
{display: '<input type="checkbox" name="chkAll" onclick="checkAll('#li
ASKER
I have Hielo, apparently it is still giving the same error
syntax error
[Break on this error] if(listID)=="#listDisplay" \n
ASKER
I think we cannot add any condition within that block in Flexigrid,...? I guess ...
>>I think we cannot add any condition within that block ..
COrrect. You have to do the if outside of that block.
COrrect. You have to do the if outside of that block.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK Hielo,
I have done something like this but still says the same
please see for "chkShow"
I have done something like this but still says the same
please see for "chkShow"
var chkShow;
if(listID)=="#listDisplay"
chkShow = '<input type="checkbox" name="chkAll" onclick="checkAll('#listDisplay')"/> All';
else
chkShow = '<input type="checkbox" name="chkAll" onclick="checkAll('#listDisplay1')"/> All';
$(listID).flexigrid
({
url: 'list_proxy.asp?a=results',
colModel : [
{display: chkShow, width : 30},
ASKER
yes this has worked...thanks
colModel : [
// {display: ' ', name : 'chkDelete', width : 30, sortable : false, align: 'left'},
{display: ( listID=="#listDisplay" ? '<input type="checkbox" name="chkAll" onclick="checkAll('#li stDisplay& #39;)"/> All' : '<input type="checkbox" name="chkAll" onclick="checkAll('#li stDisplay1 ')"/> All'), width : 30},
{display: 'Notes', name : 'notes', width : 50, sortable : false, align: 'left'},
{display: 'Contact ', name : 'pe_rev_name', width : 150, sortable : true, align: 'left'},
{display: 'Compnay Name ', name : 'co_name', width : 200, sortable : true, align: 'left'},
{display: 'Flag ', name : 'action_flag', width : 150, sortable : true, align: 'left'},
{display: 'Group ', name : 'co_group', width : 200, sortable : true, align: 'left'}
],
// {display: ' ', name : 'chkDelete', width : 30, sortable : false, align: 'left'},
{display: ( listID=="#listDisplay" ? '<input type="checkbox" name="chkAll" onclick="checkAll('#li
{display: 'Notes', name : 'notes', width : 50, sortable : false, align: 'left'},
{display: 'Contact ', name : 'pe_rev_name', width : 150, sortable : true, align: 'left'},
{display: 'Compnay Name ', name : 'co_name', width : 200, sortable : true, align: 'left'},
{display: 'Flag ', name : 'action_flag', width : 150, sortable : true, align: 'left'},
{display: 'Group ', name : 'co_group', width : 200, sortable : true, align: 'left'}
],
ASKER
can you paste the solution here
https://www.experts-exchange.com/questions/23491726/how-to-avoid-ticking-the-hidden-checkboxes.html
thanks
https://www.experts-exchange.com/questions/23491726/how-to-avoid-ticking-the-hidden-checkboxes.html
thanks
ASKER
thanks for your help
Open in new window