Extension development : Prevent selectable to automaticly convert each table to a selectable table
This is an open discussion with 9 replies, filed under Extensions.
Search
I was able to prevent this behaviour be removing the selectable-class from the table, but it seems that in Symphony 2.2 beta 2 this doesn’t cut it quite anymore.
Sounds like a bug to me. It’s not too late to report this and have it looked at for 2.2.
Changing line 385 of admin.js
to this should fix this issue:
var selectable = $('table.selectable:has(input)');
@Nils: I know this fixes this issue, but I can’t ask each and every person who installs this extension to change a line of code in admin.js.
@Nils: I know this fixes this issue, but I can’t ask each and every person who installs this extension to change a line of code in admin.js.
Hehe, I don’t think that’s what he meant. It’s just there to make it easier for the person fixing it.
Exactly :)
By the way, JavaScript events in Symphony 2.2 are namespaced so it’s possible to detach events from certain elements.
I had a similar thing recently. I am using the new orderable
plugin to rewrite my Order Entries extension, but found that the live
binding on the table was conflicting so I had to manually remove the selectable
class after applying my own ordering. Maybe I’m doing something wrong, but it’s worth considering when ensuring that Symphony’s DOM/event manipulations are as private and robust as possible.
Which live
binding was conflicting?
Got it slightly wrong. I had to remove orderable
class to prevent this happening. Can I overwrite it by redefining it, or does it simply append a second event? Or do I need to remove the live binding myself?
That’s the old admin.js
you are linking to, so I guess you meant this line: https://github.com/symphonycms/symphony-2/blob/integration/symphony/assets/admin.js#L409
You’ll have to unbind the event and bind your own function.
Create an account or sign in to comment.
Hi,
I noticed that as soon as you create a table with an input-element, it gets automaticly supplied with the selectable-helper (line 385 of
admin.js
). Is there a way to prevent this? It conflicts when a table has more than one input-element.I was able to prevent this behaviour be removing the selectable-class from the table, but it seems that in Symphony 2.2 beta 2 this doesn’t cut it quite anymore.
Is there a way to fix this?
On the other hand: isn’t it rather strange that Symphony attempts to automaticly convert each table with the selectable-helper? Wouldn’t it be better if that if the functionality is desired the extension developer adds the
selectable
-class itself?