Quantcast
Channel: Editor — DataTables forums
Viewing all articles
Browse latest Browse all 3744

search panels

$
0
0

I am having issues with the following code:

    CaseActionsEditor.on('submitSuccess', function () {
        CasesTable.ajax.reload();
        CasesTable.searchPanes.rebuild();
    });

CasesTable has some mjoins going on that are used in the searchPanes

in the code below, upon certain circumstances, a new record is created in CalendaredEvents

    CaseActionsEditor.on('postSubmit', function (e, json, data, action, xhr) {
        var actionID = CaseActionsEditor.get('CaseActions.ActionID');
        var needsCalendarRecord = 0;
        if (actionID > 0) {
            $.ajax({
                url: 'api/Actions?actionID=' + actionID,
                dataType: 'json',
                async: false,
                success: function (response) {
                    needsCalendarRecord = response.data[0]["NeedsCalendarEvent"];
                    if (needsCalendarRecord == '1') {
                        $.ajax({
                            url: 'api/CalendaredEvents?caseID=' + selectedCaseID + '&actionID=' + actionID,
                            dataType: 'json',
                            async: false,
                            success: function (response) {
                                if (response.data.length == 0) { //no existing calendar event exists, so add one
                                    var self = CalendaredEventsEditor;
                                    self.create(false)
                                        .set({
                                            'CalendaredEvents.CaseID': selectedCaseID,
                                            'CalendaredEvents.ActionID': actionID
                                        })
                                        .submit();
                                    alert("A new Calendar Event has been created.");
                                }
                            }
                        })
                    }
                }
            })
        }
    });

however, calendaredEvents can also have records added manually (and are also used in CaseTable mjoins and the searchPanes) so I have the following code:

    CalendaredEventsEditor.on('submitSuccess', function () {
        CasesTable.ajax.reload();
        CasesTable.searchPanes.rebuildPane();
        CalendaredEventHistoryTable.ajax.reload();
    });

I get this error when I try to add CaseActions record: RangeError: Maximum call stack size exceeded
And if the CaseActions results in the creation of a new CalendaredEvents record, I get this message after the record is created: Cannot read property 'searchPanes' of null


Viewing all articles
Browse latest Browse all 3744

Trending Articles