Hello .
I had the same problem of our friend WDJ , to a new record it works perfectly , but when I edit the GC JS should return the listing hangs and does not redirect .
I identified a problem with the $ this- > inline_js ( $ js_text ) ;
As a newbie commented solution
// $ this-> inline_js ( $ js_text ) ;
After I commented disponibilizei all Jquery direct view on the footer.
Thereby :
private function render_relation_dependency($target_field, $source_field, $relation_field_on_source_table){
$sourceElement = "'#field-$source_field'";
$targetElement = "'#field-$target_field'";
$js_text = "
$(document).ready(function() {
//$($targetElement).attr('disabled', true).trigger('liszt:updated');
$($sourceElement).change(function() {
$($targetElement).attr('disabled', false).trigger('liszt:updated');
var selectedValue = $($sourceElement).val();
if(selectedValue == '') {
$($targetElement).val('');
$($targetElement).attr('disabled', true).trigger('liszt:updated');
}
//alert('selectedValue'+selectedValue);
//alert('post:'+'ajax_extension/$target_field/$relation_field_on_source_table/'+encodeURI(selectedValue.replace(/\//g,'$this->slash_replacement')));
$.post('ajax_extension/$target_field/$relation_field_on_source_table/'+encodeURI(selectedValue.replace(/\//g,'$this->slash_replacement')), {}, function(data) {
var \$el = $($targetElement);
var newOptions = data;
\$el.empty(); // remove old options
console.log(\$el);
console.log('Emptied up the elements');
\$el.append(\$('<option></option>').attr('value', '').text(''));
\$.each(newOptions, function(key, value) {
\$el.append(\$('<option></option>')
.attr('value', key).text(value));
});
//\$el.attr('selectedIndex', '-1');
\$el.chosen().trigger('liszt:updated');
},'json');
$($targetElement).change();
});
});
";
// $this->inline_js($js_text);
}
View:
<body>
...
...
<script>
$(document).ready(function() {
//$('#field-iddisciplinas').attr('disabled', true).trigger('liszt:updated');
$('#field-idcursos').change(function() {
$('#field-iddisciplinas').attr('disabled', false).trigger('liszt:updated');
var selectedValue = $('#field-idcursos').val();
if(selectedValue == '') {
$('#field-iddisciplinas').val('');
$('#field-iddisciplinas').attr('disabled', true).trigger('liszt:updated');
}
//alert('selectedValue'+selectedValue);
//alert('post:'+'ajax_extension/iddisciplinas/idcursos/'+encodeURI(selectedValue.replace(/\//g,'_agsl_')));
$.post('ajax_extension/iddisciplinas/idcursos/'+encodeURI(selectedValue.replace(/\//g,'_agsl_')), {}, function(data) {
var $el = $('#field-iddisciplinas');
var newOptions = data;
$el.empty(); // remove old options
console.log($el);
console.log('Emptied up the elements');
$el.append($('<option></option>').attr('value', '').text(''));
$.each(newOptions, function(key, value) {
$el.append($('<option></option>')
.attr('value', key).text(value));
});
//$el.attr('selectedIndex', '-1');
$el.chosen().trigger('liszt:updated');
},'json');
$('#field-iddisciplinas').change();
});
});
</script>
</body>
</html>
I know that this solution is fixed and not flexible , but it was the exit to make the system work to find a solution to the underlying code.
If you can give a solution to the problem because the chouse.js this conflicts with the js.1.11.1.min.js and the script needs to be at the end of the page code. Maybe call along with the main js GC .
Tanks!