Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialog Component Input: how to set initial value? #4765

Closed
manu37 opened this issue Jan 18, 2019 · 4 comments
Closed

Dialog Component Input: how to set initial value? #4765

manu37 opened this issue Jan 18, 2019 · 4 comments
Labels

Comments

@manu37
Copy link

manu37 commented Jan 18, 2019

Noob question, but in the past, it was a single "value:" attribute. And now?

@manu37
Copy link
Author

manu37 commented Jan 18, 2019

found it:

initialData: {
              inputfieldname: {value}
            }

@manu37 manu37 closed this as completed Jan 18, 2019
@TheSpyder TheSpyder added the 5.x label Jan 22, 2019
@OmdaMukhtar
Copy link

OmdaMukhtar commented May 2, 2019

how can i set value dynamic to input ?
I have been tried this

const dialogConfig = {
        title: 'إضافة نص',
        type:'panel',
        body: [{
          type: 'container',
          label  : 'الرسالة',
          layout: 'flow',
          items: [
            {
              icon: 'unlock',
              type: 'textbox',
              name: 'my_textbox',
              label: 'textbox',
              value: textResponse,
              placeholder:'أكتب تعليقك هنا',
              multiline: true,
              autofocus: true,
            },
          ]
        }],
        initialdata: {
          my_textbox: textResponse
        },
        onsubmit: function(e) {
          // Send request to api
        }
    };
    
    const dialogMarker = {
        title: 'إضافة علامة',
        body: [{
          type: 'panel',
          // label  : 'الرسالة',
          layout: 'flow',
          items: [
              
            ],
            
          },
          {
            type: 'button',
            text: '+/-',
            name: 'alpha-button',
            icon: 'toolbarplugin',
            onclick : function(e) {
              //
             
           }
          },
          {
            type: 'button',
            text: 'إصافة نص',
            name: 'alpha-button2',
            icon: 'toolbarplugin',
            // disabled:true,
            onclick : function(e) {
              // Here is thing
              dialogConfig.my_textbox = "my new text ";

              editor.windowManager.open(dialogConfig);
    
           }
          },
        ],
        buttons:[],
        // onsubmit: function(e) {
          
        //   alert(e.data.my_textbox)
        // },
    
    };
    
     
    editor.on('click', function (e) {
      
     
        editor.windowManager.open(dialogMarker);

    });

@TheSpyder
Copy link
Member

The return value from editor.windowManager.open() is a Dialog Instance API, which has a setData method
https://www.tiny.cloud/docs/ui-components/dialog/#dialogdataandstate

@chrisdyckgeorgian
Copy link

Are there any examples that fill a selectbox or listbox fill with data from an API promise response?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants