views:

341

answers:

1

Alright totally new to jeditable,

Say I have some <div>'s and <input type='hidden' /> items that are generated dynamically with PHP like this:

<?php while($row = $db->fetch_assoc($query)) : ?>
    <input name="hiddenID" type="hidden" value="<?php echo $row['id'] ?>"
    <div class="items"><?php echo $row['item']; ?></div>
<?php endwhile; ?>

Which gives me say...this:

1 //hidden value
item1

2 //hidden value
item2

3 //hidden value
item3

And a jeditable inline-edit script to go along with it:

  hidden = $(".items").siblings("[name=hiddenID]").val(); //using a global var..don't know how to pass it into the editable function.

  $(".items").editable('save.php', {

    type      :   'text',
    tooltip   :   'Double-Click to edit...',
    onblur    :   'submit',
    event     :   'dblclick',
    submitdata : function() {
      return {id : hidden }; //how do I pass mutiple hiddenID values??
    }
  });

I am wondering how to pass multiple values into the editable function. The way I've shown here only passes one value...the first row.

A: 

I figured it out...

I wrapped the editable function in an $.each function. Works like a charm.

  $(".items").each(function(){

    var bowID = $(this).siblings("[name=bid]").val();

    $(this).editable('save.php', {

      type      :   'text',
      tooltip   :   'Double-Click to edit...',
      onblur    :   'submit',
      event     :   'dblclick',
      submitdata : function() {
        return {id : bowID };
      }
    });
  });
Scott