edit title, (using duplicate record example)

edit title, (using duplicate record example)

crush123crush123 Posts: 417Questions: 126Answers: 18
edited June 2015 in Editor

I am using the duplicate record example http://editor.datatables.net/examples/api/duplicateButton.html

The actual duplicate part works exactly as intended.

The only text field in my editor instance is a 'notes' field, which works if i use it, (though not very useful) eg

editor
                        .create( {
                            title: 'Duplicate '+values['tblitem.ItemNotes'],
                            buttons: 'Create from existing'
                        } )

My other field values are integers which display select lists.

The title will display 'undefined' as a value, whatever i choose here, whether its the select list value (eg 'tblitem.ItemTypeID') or its label (refitemtype.ItemTypeDescription)

This question has accepted answers - jump to:

Answers

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

    Can you give me a link to the page showing the issue so I can debug it please?

    The labels won't be available in the values since they are not form values - they would need to be looked up from the IDs or perhaps it might be easier to read the select label for the selected option. However, that doesn't explain why the ids aren't appearing. Are they part of a join and you need another parameter name in there perhaps?

    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    Hi Allan,

    will send you a PM

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

    Super - thanks!

    This is what the values object contains:

    {
        "tblitem.ItemPatronID": "85",
        "tblitem.ItemSchoolID": "2",
        "tblitem.ItemTypeID": "10",
        "tblitem.ItemSizeID": "35",
        "tblitem.ItemQualityID": "2",
        "tblitem.ItemPrice": "6.00",
        "tblitem.ItemNotes": "",
        "tblitem.Accepted": "1",
        "tblitem.Donated": "1",
        "tblitem.WishlistItemID": "",
        "tblitem.Sold": "0",
        "tblitem.BagtoSchool": ""
    }
    

    There is no tblitem.ItemID field which is why you are getting an undefined "value" in the title.

    If you were to use 'tblitem.ItemTypeID' then it should work.

    What is the data you actually want to show in the title?

    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18
    edited June 2015

    Thanks Allan.

    I can confirm it works with ItemTypeID

    I realise now, looking at the editor fields why it didn't work before

    I want to display the item type description. which is in my json source

    So I can just add this as a hidden, readonly field into my editor instance ?

    Looks like it'll work

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

    Yes, that would work - nice workaround.

    Allan

This discussion has been closed.