Ok
I hacked around the problem - its a bit brittle, perhaps someone can offer a more elegant approach.
You probably know I use a subclass of grocery_crud - so I can make my own changes on the fly
without touching the underlying code.
so I duplicated and modified get_true_false_input like so .
protected function get_true_false_input($field_info,$value)
{
$this->set_css($this->default_css_path.'/jquery_plugins/uniform/uniform.default.css');
$this->set_js($this->default_javascript_path.'/jquery_plugins/jquery.uniform.min.js');
$this->set_js($this->default_javascript_path.'/jquery_plugins/config/jquery.uniform.config.js');
$value_is_null = empty($value) && $value !== '0' && $value !== 0 ? true : false;
$input = "<div class='pretty-radio-buttons'>";
$checked = $value === '1' || ($value_is_null && $field_info->default === '1') ? "checked = 'checked'" : "";
//set up a class name to add to the input field that tells us if its supposed to default to checked -
//we use this in flexigrid add
$initial_checked = $value === '1' || ($value_is_null && $field_info->default === '1') ? " radio-default" : "";
$input .= "<label><input id='field-{$field_info->name}-true' class='radio-uniform{$initial_checked}' type='radio' name='{$field_info->name}' value='1' $checked /> ".$this->default_true_false_text[1]."</label> ";
$checked = $value === '0' || ($value_is_null && $field_info->default === '0') ? "checked = 'checked'" : "";
//set up a class name to add to the input field that tells us if its supposed to default to checked -
//we use this in flexigrid add$initial_checked = $value === '0' || ($value_is_null && $field_info->default === '0') ? " radio-default" : "";
$input .= "<label><input id='field-{$field_info->name}-false' class='radio-uniform{$initial_checked}' type='radio' name='{$field_info->name}' value='0' $checked /> ".$this->default_true_false_text[0]."</label>";
$input .= "</div>";
return $input;
}
then I patched flexigrid-add.js like so:
function clearForm()
{
$('#crudForm').find(':input').each(function() {
switch(this.type) {
case 'password':
case 'select-multiple':
case 'select-one':
case 'text':
case 'textarea':
$(this).val('');
break;
case 'checkbox':
this.checked = false;
break;
case 'radio':
/*use classnames to determine if this is default or not */
if ($(this).hasClass('radio-default')){
this.checked = true;
/*little hack for the uniform plugin */
if (!$(this).parent().hasClass('checked')){
$(this).parent().addClass('checked');
};
} else {
this.checked = false;
if ($(this).parent().hasClass('checked')){
$(this).parent().removeClass('checked');
};
}
}
});
Presto, problem fixed - for now.
The check boxes probably need a similar treatment - but I'm not currently using them.
Should this logged somewhere as a bug???
Cheers
Ez