[Updated] AJAX Sortable Adoptables on "myadopts.php" Page

Forum
Last Post
Threads / Messages
Well Fadillzzz, I have a suggestion for your script. Why dont you modify these lines a bit by replacing one-time loop with mysql_fetch_array()? All programming flaws such as the one below have been fixed in Mys v1.2.3:

PHP:
$i=0;
while ($i < 1) {

$aid=@mysql_result($result,$i,"aid"); //The adoptable's ID
$currentlevel=@mysql_result($result,$i,"currentlevel");
$type=@mysql_result($result,$i,"type");
$name=@mysql_result($result,$i,"name");
$tradestatus=@mysql_result($result,$i,"tradestatus");
$father=@mysql_result($result,$i,"father");
$mother=@mysql_result($result,$i,"mother");
$lastbred=@mysql_result($result,$i,"lastbred");
$adultdescription=@mysql_result($result,$i,"adultdescription");


$i++;
}
 
Hmm...that actually is not part of the mod...
That code is inside SDT's myadopts.php file. I think I'll just let her decide what to do with it.
 
Still? But I just tried it and it works... :coloness:
The only thing that you need to work on now, is probably some styling for better looking

BTW, You did click on the 'Click here to sort your adoptables' first right? before actually trying to sort the adoptables?
 
Last edited:
Again Id recommend SDT to give ftp access to Fadillzzz so he can fix the glitch much more easily. It is difficult to help with someone using a heavily customized site.
 
OMG. I bet it's worked this whole time. I thought there would be an underline link.

*smacks self*
 
Finally :madO:
I was beginning to worry that my mod is only working on my development site XD
 
Well if a Mod works on your development site, it is safe to assume it is fine on a standard Mysidia site. I am assuming SDT has a customized site already since she modified some of the script herself. This is probably why your Mod wont work on her site at the very beginning.
 
I'm not sure. The documentation doesn't explain any theming for the "sortable" interactions.
But I think you can add '.ui-sortable-placeholder' to your stylesheet and give it some properties to style it to your liking.
 
hmm what do I edit to style the table? Having some issues with it and I'm not familiar with JS.
 
If you want to edit the table body.
Just make a CSS rule with the selector 'tbody.ui-sortable'
 
like this:

tbody.ui-sortable {
color: #000;
width: 100%;
}

cause that didn't work

nm... it would help if i added <tbody> to it =p
 
Last edited:
Perhaps you should update your javascript code to this one. This will achieve what I actually wanted to make, the first javascript code I provided has a "defect" even though if you have different layout and styling the result might actually be what I expected. Nevertheless, please do try this one and see if you like it better. Otherwise, just revert back to the old javascript code.

HTML:
    $(document).ready(function(){
        
        $('body').undelegate('click').delegate('p#activate_sort', 'click', function(){
            var realBg = $('table#sortable_adoptables').css('background-color');
            var submitForm = '<form name="submit_order" id="submit_order" action="" method="post"><fieldset><label for="submit">Submit Changes</label><input type="submit" id="submit" value="Submit"></fieldset></form>';
            $('table#sortable_adoptables').css('background-color', '#FFFF66').animate({ backgroundColor: realBg },  'slow' ).find('tbody').sortable({ cursor: 'pointer' });
            $(submitForm).insertAfter('p#activate_sort').hide().slideDown();
            $('p#activate_sort').attr('id', 'deactivate_sort');
        });
        
        $('body').undelegate('submit').delegate('form#submit_order', 'submit', function(event){
            event.preventDefault();
            var data = $('table#sortable_adoptables tbody').sortable('serialize');
            $.post('ajax_sort.php', data, function(result){
                $('form#submit_order').html(result).delay(5000).fadeOut('slow', function(){
                    $(this).remove();                    
                });
            });
            $('table#sortable_adoptables tbody').sortable('destroy');
            $('p#deactivate_sort').attr('id', 'activate_sort');
        });
        
    });
 
Last edited:
You sure? that code above should preserve your table background now...instead of changing it to white :BIGO:
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,118
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top