/    Sign up×
Community /Pin to ProfileBookmark

jEditable a good edit in place plugin

I have found it a couple of days ago and incorporated into my project for the users to be able to edit a complex table as if it was a database manager. Highly recommend it to everyone – a great ajax edit in place plugin and works really fine.

Couple of tips from my experience: it passes on only two values – the id of the element you are editing and the edited value. If you want to pass on more than two values, just generate the id of the element to contain several values, divided by some special symbol and then use explode to derive the values.

Also a CSS tip: in order to style the input element, since sometimes it may not fit your design, you have to mention it not in the css file of your site, but mention it right after the script, just like in this example:

[code=html]<script type=”text/javascript” src=”jq/jquery.jeditable.mini.js”></script>
<script type=”text/javascript”>
$(document).ready(function() {

$(‘.cat_item’).editable(‘cat_edit.php’, {
cssclass : ‘tiny’,
tooltip : ‘Click to edit…’
});

});
</script>

<style>
form.tiny>input{
font-size:8pt;
}
</style>[/code]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@codingodMay 30.2009 — Man you'd be my favorite person right now if you could post the CODE you used to get this to work...I cannot for the LIFE of me figure out how to pass in the ID of the ROW I'm trying to update and thus JEditable isn't working! :mad:

PLEASE HELP!?
Copy linkTweet thisAlerts:
@Louigi_VeronaauthorJun 01.2009 — No panic, my friend!

[code=php]<?php
//this file is triggered by catalogue.php
//------------------------------------------
//jeditable has two parameters in the POST:
//element id and edited value
//so the element id in my program is actually comprised
//of two values divided by an underscore: database id
//and field name.
//So what we do is derive these two values from element id
//by using explode
//


$jeditable_id=$_POST['id'];
$value=$_POST['value'];

$arr = explode("_", $jeditable_id);

$field=$arr[1];

switch ($field){
case 'artistname':
$artist_table='artist'.$postfix;
$query1=dbQuery("UPDATE $artist_table SET name='$value' where id='$arr[0]'");
$res=dbGetData("select name from $artist_table where id='$arr[0]'");//get new value
echo $res['name'];
break;
case 'albumname':
$album_table='album'.$postfix;
$query1=dbQuery("UPDATE $album_table SET name='$value' where id='$arr[0]'");
$res=dbGetData("select name from $album_table where id='$arr[0]'");//get new value
echo $res['name'];
break;
case 'trackname':
$track_table='track'.$postfix;
$query1=dbQuery("UPDATE $track_table SET name='$value' where id='$arr[0]'");
$res=dbGetData("select name from $track_table where id='$arr[0]'");//get new value
echo $res['name'];
break;
case 'percent':
$track_table='track'.$postfix;
$query1=dbQuery("UPDATE $track_table SET percent='$value' where id='$arr[0]'");
$res=dbGetData("select percent from $track_table where id='$arr[0]'");//get new value
echo $res['percent'];
break;
}

?>[/code]
Copy linkTweet thisAlerts:
@dragancSep 25.2009 — thanks Louigi, this tip saved me from frustration ?
×

Success!

Help @Louigi_Verona spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.4,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...