Add cleared/selected callbacks for jquery autocomplete in forms2
This commit is contained in:
parent
bb12c5107c
commit
789bdef190
3 changed files with 42 additions and 2 deletions
|
@ -39,6 +39,8 @@
|
|||
$('#' + oid + '-display span:first').text(ui.item.label);
|
||||
$('#' + oid + '-textbox').hide();
|
||||
$('#' + oid + '-display').show();
|
||||
$('#' + oid + '-textbox').trigger('autocompletevalueselected',
|
||||
[ui.item.value, ui.item.label]);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -50,12 +52,35 @@
|
|||
show();
|
||||
focus();
|
||||
}
|
||||
$('#' + oid + '-textbox').trigger('autocompletevaluecleared');
|
||||
});
|
||||
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<script tal:condition="cleared_callback" type="text/javascript">
|
||||
deform.addCallback(
|
||||
'${oid}',
|
||||
function (oid) {
|
||||
$('#' + oid + '-textbox').on('autocompletevaluecleared', function() {
|
||||
${cleared_callback}();
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<script tal:condition="selected_callback" type="text/javascript">
|
||||
deform.addCallback(
|
||||
'${oid}',
|
||||
function (oid) {
|
||||
$('#' + oid + '-textbox').on('autocompletevalueselected', function(event, uuid, label) {
|
||||
${selected_callback}(uuid, label);
|
||||
});
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<script tal:condition="cstruct" type="text/javascript">
|
||||
deform.addCallback(
|
||||
'${oid}',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue