How to set up Jeditable in edit mode initially?

How to set up Jeditable in edit mode initially?

cmanvacmanva Posts: 37Questions: 0Answers: 0
edited November 2011 in General
Is it possible to have Jeditable field to start off in edit mode. For example instead of a label with "Click me to edit", I would see a textarea with a save and cancel button?

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited November 2011
    http://www.appelsiini.net/projects/jeditable

    Documentation page says there's an "event" parameter you can set as the trigger to enable editing. default is "click", but you can override this to whatever you want.

    You could probably create your own custom event name and programatically trigger that event in jquery.

    (I haven't tested this, but) it would be something like this:
    [obviously there are slight changes if you're using the jeditable plugin rather than using jeditable directly]
    (samples taken from http://www.appelsiini.net/projects/jeditable/default.html - view the source)

    [code]
    // sample of setting event with 'dblclick' and 'mouseover' from the sample site
    $(".dblclick").editable("http://www.appelsiini.net/projects/jeditable/php/echo.php", {
    indicator : "",
    tooltip : "Doubleclick to edit...",
    event : "dblclick",
    style : "inherit"
    });
    $(".mouseover").editable("http://www.appelsiini.net/projects/jeditable/php/echo.php", {
    indicator : "",
    tooltip : "Move mouseover to edit...",
    event : "mouseover",
    style : "inherit"
    });

    /////////////////////////////////////////////////////
    // now for your DataTables project and a custom event

    // make some custom event that we make up
    $(".mycustom").editable("http://www.appelsiini.net/projects/jeditable/php/echo.php", {
    event : "mycustomevent",
    });


    // later in your javascript file, after the datatable has been initailized (the fnInitComplete callback might be a nice place)

    $(".mycustom").trigger("mycustomevent");

    [/code]
  • cmanvacmanva Posts: 37Questions: 0Answers: 0
    Sorry lost track of this.
    on the Jeditable website, in order to set it in edit mode initally. I was told:

    You can trigger the used event when your document loads. For example:

    $(function() {
    $("#editable").trigger("click");


    Not sure how to access this trigger event on Datatables? Any help?
This discussion has been closed.