lcollong
FabriKant d'applications web
Hi,
I'm using ajaxified list with ajax links. The "real" list has several joins. In order to minimize the loading time of the list as well as using some specific features (order of element...), I have a second list without joins. I use custom links so the edit link bring up the right full joined form.
Everything is fine. However, on closing the popup window, Fabrik.js Fabrik.openSingleView function is producing an error on this line (around #455) :
the reason is the way "k" is build :
formid is the form connected to the displayed list. But since I use custom link, the real formid is given by the url used to open the window. Not the list's formid in this case.
This part of the code is inside a "try". So in most browser, the result is only showing the "catch" which displays the error message. And it seems to not have some side effect (actually not destroyed, event not triggered).
But in some browser (some specific version of Firefox for linux ?...), these lines produces a fatal error not trapped. So the rest of the js on the page is broken.
I did the following patch on the file media/com_fabrik/js/fabrik.js in order to "catch" the right formid from the url. But I'm not sure to understand why the "isCustom" is not set in this case and how the whole thing is intended to work actually.
However, I do not trigger any error this way :
Does it make sense ?
I'm using ajaxified list with ajax links. The "real" list has several joins. In order to minimize the loading time of the list as well as using some specific features (order of element...), I have a second list without joins. I use custom links so the edit link bring up the right full joined form.
Everything is fine. However, on closing the popup window, Fabrik.js Fabrik.openSingleView function is producing an error on this line (around #455) :
Code:
Fabrik.blocks[k].destroyElements();
Code:
var k = view + '_' + list.options.formid + '_' + rowId;
This part of the code is inside a "try". So in most browser, the result is only showing the "catch" which displays the error message. And it seems to not have some side effect (actually not destroyed, event not triggered).
But in some browser (some specific version of Firefox for linux ?...), these lines produces a fatal error not trapped. So the rest of the js on the page is broken.
I did the following patch on the file media/com_fabrik/js/fabrik.js in order to "catch" the right formid from the url. But I'm not sure to understand why the "isCustom" is not set in this case and how the whole thing is intended to work actually.
However, I do not trigger any error this way :
Code:
// if it's a custom link, don't add our junk 'n' stuff
if (jQuery(target).data('iscustom') !== 1) {
url += url.contains('?') ? '&tmpl=component&ajax=1' : '?tmpl=component&ajax=1';
url += '&format=partial';
}
// APCHEA
var apchea_form_id = list.options.formid;
if (jQuery(target).data('iscustom') !== 1) {
var bouts = url.split('/');
for (var i = 0; i<bouts.length; i++) {
if (bouts[i] == 'form') apchea_form_id = bouts[i+1];
}
}
//console.log(apchea_form_id);
// APCHEA
title = a.prop('title');
loadMethod = a.data('loadmethod');
if (loadMethod === undefined) {
loadMethod = 'xhr';
}
// Only one edit window open at the same time.
jQuery.each(Fabrik.Windows, function (key, win) {
win.close();
});
winOpts = {
modalId : 'ajax_links',
id : listRef + '.' + rowId,
title : title,
loadMethod: loadMethod,
contentURL: url,
onClose : function () {
//APCHEA var k = view + '_' + list.options.formid + '_' + rowId;
var k = view + '_' + apchea_form_id + '_' + rowId;
try {
Fabrik.blocks[k].destroyElements();
Fabrik.blocks[k].formElements = null;
Fabrik.blocks[k] = null;
delete (Fabrik.blocks[k]);
var evnt = (view === 'details') ? 'fabrik.list.row.view.close' : 'fabrik.list.row.edit.close';
Fabrik.fireEvent(evnt, [listRef, rowId, k]);
} catch (e) {
console.log(e);
}
}
};
Does it make sense ?