Options with Nested Editor

Options with Nested Editor

ChopShopChopShop Posts: 17Questions: 5Answers: 0

I found an interesting issue when developing the nested table.
I started first wit ha table with options to ensure that the basics worked.

Then I added the nested portion of the code. It would not work no matter what I tried.
Then I looked at the example that you provided and noticed that the nested tables example had options = [].

So I sent the data with the options as in the example. Then it all worked without error.

Sending options and using nested data in the same table caused me an issue. The options data had data for the same field as was referenced in the nested portion. So I assume then that the options data and the data from the nested object query conflicted even though I chose a different field type. One was a select and the other datatable.

It had me running in circles for days. I would fix it in one table and break it in another.

Answers

  • ChopShopChopShop Posts: 17Questions: 5Answers: 0

    This was the kind of error message that I kept getting.
    DataTables warning: table id=bundles - Requested unknown parameter 'query' for row 0, column 3. For more information about this error, please see http://datatables.net/tn/4

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Hi,

    Which example are you referring to with the options = []? I've just add a look at this example but it doesn't use that.

    I'm just wondering what I can tidy up in the documentation to make this easier for others in future (and perhaps yourself when you come back to it in a few years time and wonder what is going on! ;)).

    Allan

  • ChopShopChopShop Posts: 17Questions: 5Answers: 0

    There were a couple of things that tripped me up. When you do a search on optionspair it returned few results. I did eventually find an entire section dedicated to that. It was here: https://editor.datatables.net/examples/datatables/properties.html
    So it appears that the search just didn't find it easily.
    The answers are there but not always obvious.
    For instance what is the data structure that should be returned by the ajax query below.

    This section


    { label: 'Region:', name: 'country.regionid', type: 'datatable', editor: regioneditor, optionsPair: { value: 'DT_RowId', label: 'region' }, config: { ajax: '/data?data_type=region', buttons: [ { extend: 'create', editor: regioneditor }, { extend: 'edit', editor: regioneditor }, { extend: 'remove', editor: regioneditor } ], columns: [ {"data": "region"}, {"data": "status"} ], dom: bstrapDom, } }

    I still a bit of a mystery. If I send data in the initial load "options" that has the element key of 'country.regionid', the it will conflict with the data pulled by the ajax call above.

    I do appreciate the help. I have one last minor issue.
    When I edit a nested row it will should the regions in the list but not highlight the correct region associated with the country. If you submit without selecting a region it just wipes it out. When you select a region and the submit everything works fine.

    Still wondering about that one.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    I think what I'll do is introduce a new specific piece of reference documentation for optionsPair, since it is used through at least four built in plug-in types and some of the plug-ins. Thanks for highlighting that!

    With the remaining problem, can you give me a link to your page showing that issue so I can check out what is going wrong? First thing to do would be to check what data is being submitted from the client, to identify if it is a client-side or server-side issue.

    Allan

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    I've added specific documentation for fields.options and fields.optionsPair (note those links will give errors until I update the site with the next Editor release).

    Thanks again for the feedback!

    Allan

  • ChopShopChopShop Posts: 17Questions: 5Answers: 0

    The dev environment is behind several firewalls. Would a Team Viewer session work for you? I can send the info by email.

  • ChopShopChopShop Posts: 17Questions: 5Answers: 0

    I sent an email with connection information that I hope will work for you.

  • ChopShopChopShop Posts: 17Questions: 5Answers: 0

    I figured it out! The form submits numbers as string but the database returned numbers as numbers and the json went out with numbers and not text.
    I converted the numbers to string and it works now.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Perfect - many thanks for the update. Great to hear you've got it working now.

    Allan

Sign In or Register to comment.