DataTables “Custom Commands”
-
Hello Tobias,
it is possibile to change <input> to <textarea>? It would be nice to spread the conmmands over several lines (multiline).
Cheers
Sascha
-
Hi,
thanks for your post, and sorry for the trouble.
The problem with textareas is that I would need to add extra handling for input sanitization. If you have large commands to edit, I suggest to quickly copy/paste them into a text editor.
Regards,
TobiasHello Tobias,
what do you handle with inputs that textareas do not support?
The workaround with copy/paste requires a copy to keep the linebreaks. On the other side copying formatted code includes indentations inline. Do you know if there a way to include a file with the code into DataTables?
Cheers
SaschaHi Sascha,
those line breaks are what I’m afraid of here, somehow. Thinking about it now, the potential problems probably don’t really exist anymore. I guess this was just one of those decisions when I first introduced the “Custom Commands” field…
After thinking about, and as it ultimately only is JavaScript, line breaks should not actually cause problems, indeed…
It’s probably a good idea to switch that input field to a textarea (which can have a small height when it’s empty)…
Regards,
TobiasHello Tobias,
that would be great, really! Perhaps I could create a JS script solving this “problem” but I don’t like “miracles” to make it working. YOU are the expert!
Thank you 🙂
Regards
SaschaHi,
I’m not sure what you mean with JS script here. The easiest solution should be to just change the field type in the code that generates the HTML.
And I just remembered another reason why I chose an input over a textarea for this field: With a textarea the risk of people falsely putting “Custom CSS” code into the field would be much higher. But if I keep the height small, that risk is probably low again.
Regards,
TobiasHello Tobias,
you are right: changing the original code is be the best solution. But I dont’t want to change original code that might lead to unwanted side effects. This is why I am using JS in many cases. Furthermore errors appear on client side and NOT on the server. And – for me – it’s very flexibal, too.
Confounding “Custom CSS” and “Custom Commands” should not be your problem. You cannot catch all user errors. All in all TablePress is idiot-proof ;).
Cheers
SaschaHi,
but it often becomes my problem when people then ask questions why their CSS is not working 😉
Ok, I’ll look into changing the input to a textarea in the next version!
Best wishes,
TobiasHello Tobias,
yes, I forgot: You are the technical hotline, too. Perhaps there is a simple way to make it proof (e.g. additional info, syntax validation etc.). For me it’s proof enough ;). Thanks again.
Have a nice day
SaschaHi,
the added description definitely helped already!
Best wishes,
Tobias
The topic ‘DataTables “Custom Commands”’ is closed to new replies.