close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Tutorial for AJAX Sortable Rows with Data Assist

Thread began 1/21/2010 3:46 am by anonymous | Last modified 5/29/2015 7:07 pm by anonymous | 23294 views | 82 replies

neo314

Hi,

I see two possible issues fight off:

First is the javascript include. You have to feed that the path to the file with a trailing slash and be sure it reaches the correct folder:

echo $reorder->insertJS("includes");

Should be:

echo $reorder->insertJS("includes/");

And if you are in any kind of subdirectory like /admin/magazines/magazine_reorder.php, then it should be like this:

echo $reorder->insertJS("../../includes/");

The other issue is... I could be wrong about what your doing, but I cannot see what you want to reorder on. You are currently trying to reorder magazines on CategoryID. I can't imaging you really want the CategoryID of the magazine to change every time you sort you list. I think you need a "sortorder" column for magazines. What you are probably trying to do is list magazines by category and sort the list of magaiznes within that category.

To do that you want to filter your recordset by category and then use a reorder column to determine the order of the magazines inside that category (rather than simply alphabetical sorting).

If I am wrong about what you want to do, this may still explain it.

You need to add a column called something like sortorder (don't use the word order because that is a reserved word in mySQL). The value of sortorder for existing records can be initialized to the record id, but each record has to have a unique number.

After adding the field, you can execute this SQL to get what you need.

UPDATE Magazines SET sortorder = id WHERE 1=1

BIG WARNING: TABLE NAMES WITH CAPITAL LETTERS MAY BREAK WHEN MOVING BETWEEN A WINDOWS MACHINE AND A UNIX SERVER. RESEARCH THAT OR ONLY USE LOWER CASE TABLE NAMES

Now your code should look more like this. I am not fizing everything, so review the tutorial, but this will give you the idea (Look for the bold items):

<?php
/*MOD reorder create the reorder object below the max rows is modiefied to create controls and allow for user control how many rows are shown
*/
$reorder = new reorderDA($database_vip_magazines, $vip_magazines, 'MagazineID', 'Magazine_Title', 'sortorder', 5, $_SERVER['PHP_SELF']);
/* end mod reorder
(see max rows below)
*/
?>
<?php
$maxRows_WADAreorder = $reorder->getMax();
$pageNum_WADAreorder = 0;
if (isset($_GET['pageNum_WADAreorder'])) {
$pageNum_WADAreorder = $_GET['pageNum_WADAreorder'];
}
$startRow_WADAreorder = $pageNum_WADAreorder * $maxRows_WADAreorder;

mysql_select_db($database_vip_magazines, $vip_magazines);
$query_WADAreorder = "SELECT MagazineID, Magazine_Title, `Description`, CategoryID, percentage, Date_added, Issues, sortorder FROM Magazines ORDER BY sortorder ASC";
$query_limit_WADAreorder = sprintf("%s LIMIT %d, %d", $query_WADAreorder, $startRow_WADAreorder, $maxRows_WADAreorder);

And down in the page:
... rest of code ...

echo $reorder->sortArrays($row_WADAreorder['MagazineID'], $row_WADAreorder['sortorder']);

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...