How to create a Pre-Populated DTEditor?
How to create a Pre-Populated DTEditor?
Hello, i am trying to prepopulate a DTEditor, but the issue i am having is that the Editor is remembering the var previously set.
What i am doing at the moment is prepopulating an Editor field using an external add button. But when i use another add button , it is remembering the old added value.
Is there anyway to call the "dataConnectionsEditor.on('open ', function (e, json, data)" and sent some parameter to that function? If so please tell me how.
Thank you in advance and your precious time for reading this.
dataConnectionsEditor.on('open ', function (e, json, data)
{
var userEnteredQueryDataDipConfig = $("#actionDataDipConfigQueryCombo").mnCombobox('getMyValTyped');
$('#DTE_Field_name').val(userEnteredQueryDataDipConfig); //transfer userTypedQuery from CallFlowConfig to DTEditor
//var actionSalesforceDataDipQuerySelectVal = $("#actionSalesforceDataDipQuerySelect").mnCombobox('getMyValTyped');
//$('#DTE_Field_name').val(actionSalesforceDataDipQuerySelectVal);
});
This question has accepted answers - jump to:
Answers
Or, Is is possible to call the Editor create method with parameter which will then prepopulate the form?
The Editor
create
should populate the form using the field defaults (fields.def
). It shouldn't be using the value form a previous edit. Are you able to link me to a page that shows that problem?At the point above you can use
val()
to set the values of the fields that you want (note I would recommend using the Editor API rather than the direct DOM manipulation as you have above) - for exampleeditor.val( 'name', serEnteredQueryDataDipConfig );
Thanks,
Allan
Nice, thank you very much Allan. I appreciate you answer. It does work only after the first time i press the add button. On the second time the form open, is then prepopulated. Am i doing something wrong? Am i using the right event listener (open )? I have also tried init, pre-open, but does not work :-( . I am sorry for not being able to provide a link coz the site is not online yet. Any help or advice will be very much appreciated.
Thks again for your previous solution Allan
Okayyy, i found the solution, i should not put my code in dataConnectionsEditor.on('open', function (e, json, data). For the people who might read this in future:
This chunk of code prepopulated your DTEditor form with the vale set(name in this case).
loving this editor it has numerous possibilities...
Thnks Allan
Good to hear you got it working :-)
Allan