column with dynamic field type ?

column with dynamic field type ?

flyshellflyshell Posts: 9Questions: 3Answers: 0

I have a table [SystemSettings] with 3 columns { name::string, value::string, field_type::string}

however [value] could be any field type data.

text

textfield

upload file

select option

so, my question is:
in editor, is it possible to have a column with dynamic field type and how??

please help
Yang

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Sorry no. In Editor, once a field has been created its fields.type parameter cannot be changed. You would need to remove the existing field (remove()) and then create a new one based on the field type you want (add()).

    Allan

  • flyshellflyshell Posts: 9Questions: 3Answers: 0

    I got it figured by using 'editor.clear' and editor.add'
    everything worked fine,

    however after clearing and adding a field with type [ckeditor], it no longer worked.
    any other clear/add procedures after it, would always be [ckeditor]..

    for examples:

    row 1 [type = text]
    row 2 [type = textarea]
    row 3 [type = upload]
    row 4 [type = ckeditor]

    step 1. clicked between row 1~3, the input fields shown as expected. (OK)
    step 2. clicked row 4, the input fields shown as ckeditor (OK)
    step 3. clicked row 1, the input filed still shown as ckeditor with blank data (OOPS)

    maybe something wrong with ckeditor plugin..
    something not cleared after using ckeditor.......

    please help.... thx

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    If you could post a link to the page showing the issue I'd be happy to take a look.

    Thanks,
    Allan

  • flyshellflyshell Posts: 9Questions: 3Answers: 0

    please check this url http://beatastudio.erawppa.com/test.jsp

    u can click on
    1_TEST_SELECT
    2_TEST_TEXT1
    3_TEST_TEXT2

    it worked,
    but once you click on 4_TEST_CKEDITOR, others no longer working

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Thanks for the link!

    Could you try adding the following to the ckeditor plug-in for Editor please:

        destroy: function () {
            var id = DataTable.Editor.safeId( conf.id );
    
            this.off( 'open.ckEditInit-'+id );
            this.off( 'preClose.ckEditInit-'+id );
        }
    

    Just putting it immediately after the disable function (and obviously adding the comma) should do it.

    I think the issue is that the plug-in is assigning event handlers, but isn't then clearing them when removed.

    Thanks,
    Allan

  • flyshellflyshell Posts: 9Questions: 3Answers: 0

    cool,,, it works!!!!

    THANKS!!!!!! :)

    one minor thing,, in case someone having the same problem....

    it needs to put conf in parameter,

    destroy: function (conf) {
    ....
    }

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Oops - thanks. I'll update the plug-in on the site shortly.

    Regards,
    Allan

This discussion has been closed.