Select2 Tagging issue.

Select2 Tagging issue.

kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

Hi Allan,

Sorry for troubling you so often.. but

I am trying to use Select2 plugin with Tagging enabled.

Although it works correctly, but I am facing 1 issue in editing

When i try and edit a record, the tags/selectoptions are not pre populated in the select box.. and when I try and update the data manually it shows all the tags as selectable options and not tags..

Kindly please help me with this.

you can find the entire JS here...

http://gadhiya.in/web/js/commodity_transaction_field.js

Regards
Kaustubh

Answers

  • allanallan Posts: 61,443Questions: 1Answers: 10,053 Site admin

    Hi,

    Could you give me a link to the page that shows the issue so I can debug it with the live data please? I don't immediately see the issue, although if you could remove the initEdit event handler as well, that would be good, since it shouldn't be required.

    Allan

  • kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

    hi Allan Please find the details

    website : http://gadhiya.in
    Uname : kaustubh.agrawal2012@gmail.com
    Pwd : 12345678
    
    goto: http://gadhiya.in/commoditytransactionfield
    
    try editing the last row .. with field name as "Kapas-qr"
    
    the JS file path is 
    http://gadhiya.in/web/js/commodity_transaction_field.js
    
    the API response can be checked here
    http://gadhiya.in/api/commoditytransactionfield
    
    The response has "select_options" as 
    select_options: [
        "option1",
        "option2",
        "option3", 
        "option4"
    ]
    

    I can see the options as select options... but not as tags...

    kindly help me with debugging this.

  • kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

    1 more thing...
    I Want the tags to be passed to my api as CSV string but currently they are passed as array.. and vice versa as well.. from API currently I am returning an array but I Want it to be populated from a CSV string.

    I thing I might have to update the value in preCreate events... but cant seem to figure that out.

    Kindly help me..

  • kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

    Additionally,

    when the select field is empty, the field is not included as a parameter to API Call.

    which is a problem for me..
    What I am looking for is ..

    1) Even if the field is blank. a blank parameter should be sent to the API
    2) if I select N options from dropdown, they should be sent to API as comma seperated string and not an array.
    3) When my API returns a Comma seperated string, it should properly populate the tags with the returned data..

    Regards

  • kaustubh.agrawal2000kaustubh.agrawal2000 Posts: 88Questions: 39Answers: 2

    Allan... have you got time to check on this ?

This discussion has been closed.