Ok I’ve tried that and it seems to work fine in FF. Allows editing and denies editing just as I wanted.
Then I tried to move it over to IE and it snapped like a twig. It doesn’t throw an exception or a warning of any kind. The page builds and looks correct but when I try to click on the checkbox, particularly the second one it just doesn’t seem to pick up on it.
The state of the checkbox doesn’t change and the fields to the right of it won’t appear. If I click it repeatedly sometimes it will register and put a check in the box but whether the fields to its right will appear or will disappear when I get the check out of the box seems to be hit or miss.
I haven’t run into this problem before. The SC developer console is not flagging any errors or warnings either. It seems like the code simply is incomptaible with IE. Can anyone help me?
Requirements again:
I have a grid that has two checkboxes in it. The second one should be disabled from editing UNLESS the first is checked. The first checkbox can be edited anytime. There are four text fields after the second checkbox that can only be filled in if the second checkbox is checked (which implicitly means the first checkbox must also be checked). If a check box is unchecked, the data must be removed from subsequent fields and the subsequent fields disabled.
isc.ListGrid.create({
ID: "SelectVersionGrid",
name:"SelectVersionGrid",
alternateRecordStyles: true,
showAllRecords: true,
canEdit: true,
data:ProposalCustomData,
fields: [{
name: "state",
title: "State",
editorType:"TextItem"
}, {
name: "domain",
title: "Domain",
editorType:"TextItem"
}, {
name: "pricingLead",
title: "Pricing Lead",
editorType:"TextItem"
},
{
name: "versionNumber",
title: "Version #",
editorType:"TextItem"
},
{
name: "versionDescription",
title: "Version Description",
editorType:"TextItem"
},
{
name: "accept",
title: "Accept",
editorType:"checkbox",
changed:"Accept()"
},
{
name: "collapse",
title: "Collapse",
editorType:"checkbox",
changed:"Collapse()"
},
{
name: "burden",
title: "Burden",
editorType:"comboBox"
},
{
name: "rateGroup",
title: "Rate Group",
editorType:"comboBox"
},
{
name: "resCode",
title: "Res Code",
editorType:"comboBox"
},
{
name: "subRes",
title: "Sub Res",
editorType:"comboBox"
},
{
name: "resourceDescription",
title: "Resource Description"
}
],
canReorderFields: true,
sortFieldNum: 0,
canSort: true,
autoDraw: false,
autoFetchData: false,
canEditCell:function(rowNum, colNum){
//we don't care about columns before #6 so skip logic
if(colNum < 6)
return true;
//Get relevant values
var Record = SelectVersionGrid.getCellRecord(rowNum);
var AcceptValue = SelectVersionGrid.getEditedCell(Record, 5);
var CollapseValue = SelectVersionGrid.getEditedCell(Record, 6);
//If Accept checkbox is checked enable Collapsed checkbox
if( (colNum == 6) && (isFalseOrUndefined(AcceptValue) == true))
{
return false;
}
//If collapsed checkbox is enabled, enable the rest of the fields
if( (colNum > 6) && (colNum < 12) && (isFalseOrUndefined(CollapseValue) == true))
{
return false;
}
return true;
}
});
//utility function to see if a checkbox is true or false
function isFalseOrUndefined(value)
{
if(value == undefined)
{
return true;
}
if(value == false)
return true;
return false;
}
//Function that fires when Accept state changes
//Basically just a way to refire canEdit after Accept becomes true
//If Accept just became false we reset all disabled fields and refire canEdit to do the disable
function Accept()
{
var Record = SelectVersionGrid.getSelectedRecord();
var AcceptValue = SelectVersionGrid.getEditedCell(Record, 5);
if(isFalseOrUndefined(AcceptValue) == true)
{
SelectVersionGrid.setEditValues(SelectVersionGrid.getRecordIndex(Record), {"accept":false, "collapse":false, "burden":"", "rateGroup":"", "resCode":"", "subRes":"", "resourceDescription":"" });
}
SelectVersionGrid.startEditing(SelectVersionGrid.getRecordIndex(Record));
}
//Function that fires when Collapse state changes
//Basically just a way to refire canEdit after Collapse becomes true
//If Collapse just became false we reset all disabled fields and refire canEdit to do the disable
function Collapse()
{
var Record = SelectVersionGrid.getSelectedRecord();
var CollapseValue = SelectVersionGrid.getEditedCell(Record, 6);
if(isFalseOrUndefined(CollapseValue) == true)
{
SelectVersionGrid.setEditValues(SelectVersionGrid.getRecordIndex(Record), {"accept":true, "collapse":false, "burden":"", "rateGroup":"", "resCode":"", "subRes":"", "resourceDescription":"" });
}
SelectVersionGrid.startEditing(SelectVersionGrid.getRecordIndex(Record));
}