how to pause and restart jquery datatables plugin - javascript

I'm trying to transform a row of my table in a form by clicking a button. My problem is the table uses Datatables plugin, and I would like to disable the script (filtering, sorting ecc.), and reactivate it after submit.
I was trying now to use bDestroy while starting a new istance with filtering and sorting disabled, but I would like to totally disable the script, because it may create new issues to my script.

The function I was looking for is fnDestroy(), then you can reinitialize the table when you want, in my case on submit or cancel the form

Related

How to call JavaScript after PrimeFaces DataTable row click

I wanted to use the features from PrimeFaces DataTable so I've implemented the framework and rebuilt my current table (built with JSF) with the DataTable. Now I have a problem in that I don't know how I can call a JS function on row click.
This was my previous implementation:
onclick="onRowClick(this, event)"
With a JSF component it was possible to detect a row click. Now I want to implement this with PrimeFaces to detect the exactly the same row click in the DataTable.
Is there any simple way to deal with this? onclick is not available for this PrimeFaces component so I can't just copy this.

In Salesforce open the edit screen after the object was created with Javascript button

In Salesforce, we have a button that creates events with the fields already filled out, but after the item is created I want it to reload the screen in the "Edit" view in case they want to change anything. Any ideas?
Do you need to validate fields values? Maybe it will be easier to do with field validation rules? It can be useful in cases when your data is populated not only from user screens, but also can be created in code (classes/triggers) or via API.
If you know that you exactly should to use JavaScript, you can add standard event attributes to command buttons on your Visualforce page and write JS functions for implementation of your validation logic.
I ended up creating a visualforce page with a controller and a custom button to accomplish what I needed.

CKEditor button to add table rows

I'm trying to make an add button (NOT a toolbar button), so when you click on it, a new row is added to the bottom of an already existing table.
Any idea how to do this? Should it just be a button that calls a add-row-function or should it be added to the table plugin (not sure how to add it to the plugin)
Just add the 'tabletools' plugin and you'll have this feature for free. You only need to right-click on a table row.
http://ckeditor.com/addon/tabletools

Ignoring Validators

I have a page where I use Javascript and a <input> button to hide the ability to add a new user to my database. To ensure that people enter in accurate info, I have added validators which works great. The issue, is that I also have a GridView and a search facility on this page and because I use Javascript to hide it, no click events will trigger because those textboxes attached to the validators don't have correct data in them. Is there a way to get it to ignore the validation unless the above button has been clicked?
I wrote this and had another crack at Google. My issue was that I could add CausesValidation="False" to the ASP:BUTTON control which worked, but I was using HTML to generate the Add User button instead of ASP.NET. Since I was using JQueryUI, I found it easier to search how to change from <input> to <asp:button> controls which I did by changing the javascript from:
$("#button").click(function () {
to:
$("input[id$='AddButton']").click(function () {
If I understand it correctly, <asp:button> is rendered into HTML as input[id=... etc. Adding in $ meant that that the script applied to any <asp:button> that ended in AddButton. I needed this since I had a few Search buttons on this page hidden in other Views and still wanted a consistent naming structure on the page. The alternative was to use the ^ symbol instead which would apply the script where AddButton is at the start of the ID.
Try setting validation group on that set of fields you want to validate. This should make the validators work only on that set of controls and no other.
Set the validation group on all input controls, validation controls and submit button.

popup screen won't show after submitting a form

I am building a web app with jquery mobile. On one page I have a little form to make a room reservation. I have two input boxes. In these boxes comes the start DateTime and in the other one the end DateTime.
Now what I do is the following, when I click on the input box there comes an popup box where you can insert a DateTime. The plugin is called mobiscroll.
I am opening it like this in my JS.
$('[data-role=page]').live('pageinit', function(event){
$("#DATUM_BEGIN").scroller({ preset: 'datetime',theme: 'jqm', mode: 'mixed',display:'modal'});
$("#DATUM_EINDE").scroller({ preset: 'datetime',theme: 'jqm', mode: 'mixed',display:'modal'});
});
The first time it does is correctly. But If I for example forget to enter the end date and submit my form with the submit button. It shows the error messages on the screen. But whenI then want to enter a date. The popup box won't show.
Does anybody know how I can solve this on a correct way?
EDIT: SOLUTION
Ok I found the solution, you just need to disable the ajax with and it will work.
You can disable your ajax on a form by using the attribute data-ajax=false
You should use
$(page).live('pageinit', function(event){
// Your code
// 'page' is a selector for the jquery mobile page you want to work on
});
instead of:
$(document).ready(function(){});
You can see why here http://jquerymobile.com/demos/1.1.0/docs/api/events.html
I think it might be this problem, but even if it's not, I would work that way, it will avoid several headaches.

Categories

Resources