Standalone remove() Error

Standalone remove() Error

enielsonenielson Posts: 6Questions: 3Answers: 0

Getting the

TypeError: a is undefined
    ...rCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e...

When I try to use remove() standalone:

         $('#remove_list').on( 'click', function () {
            editor.buttons({
                        label: "Remove",
                        fn: function () { 
                            this.submit( function () {
                                load_dropdown("#rule_list", "/json/get_domainlists/");
                            }); 
                        }
                    })
                    .remove($("#rule_list").val());
            } );

Here's how I initialize the editor:

        var editor = new $.fn.dataTable.Editor( {
            ajax: "{% url 'json_editor_domainlist' %}",
            fields: [ {
                    label: "List Name:",
                    name: "list_name"
                }, {
                    label: "Note:",
                    name: "list_note"
                }, {
                    label: "ID",
                    name: "list_id"
                }
            ]
        } );

I need to pass an ID to the server for removal. I'll also need it for edit() also. How do I do this?

This question has an accepted answers - jump to answer

Answers

  • neilrao42neilrao42 Posts: 14Questions: 2Answers: 1
    edited November 2014

    I'm unsure what you are trying to do. Ajax is usually asynchronous, so it's likely that your table hasn't updated by the time you try to remove any rows.

    Edit: if you are trying to remove rows when the user selects an option, you should bind a change handler to the dropdown and then call editor.remove() from there.

  • enielsonenielson Posts: 6Questions: 3Answers: 0
    edited November 2014

    I wasn't very clear in the question because I was expecting this to go in the Editor forum but it ended up here. This question is for the standalone functionality in the editor extension.

  • allanallan Posts: 61,746Questions: 1Answers: 10,111 Site admin
    Answer ✓

    Hi,

    I'm afraid you've hit a bug in Editor here. I've corrected it in the dev version now.

    Can I e-mail you an updated trial file with the fix at the e-mail address you used to register your account?

    Allan

This discussion has been closed.