Hi,
I'm trying to emulate part of our client-server application as a web
site so customers can use it, and I'm stuck when it comes to
re-ordering items in a list.
Basically we have a list of available articles ("availableItem s") and
a list of articles already in an issue ("selectedItems "). What I want
is to be able to move articles freely between the two lists and then
on submission add them to the issue (which I can), but also move items
in the "selectedIt ems" list around so that they can be re-ordered
(i.e. I want the customers to be able to change the order in which the
articles appear in the issue).
I can do both these things on screen (i.e. I have written Javascript
to move them from one box to the other (add/delete them from
"selectedItems" ) and to move individual articles up or down the list
of articles in the issue. Befor submitting I run a Javascript loop on
the list to select them all, from top to bottom. On screen it always
selects them in the right order (i.e. top to bottom, no matter whether
I have changed the order of these items) but when I grab the array
containing the item id numbers it's as if the change in order had
never happened!!!
Newly added or deleted papers get added/deleted fine, but when I fetch
the array from "selectedIt ems" I always end up with the items in the
same order, with the latest items added at the end. However, being
able to change the order of these items is crucial for this project,
but so far I have been unable to do this and I haven't found any
information on how to grab the new ORDER of items.
Here's some of the code:
I retrieve the array like this:
/*
$ia_items_new = $_POST['selectedItems'];
*/
However, this still lists the items in the OLD order:
/* if ($ia_items_old) {
foreach($ia_ite ms_old as $key => $value) {
//echo("<BR>Old: No.".$key." - ".$value);
}
}
/*
Populating the "selectedIt ems" box:
/*
print( " <td><select multiple size='20' \n" );
print( " id='selectedIte ms' \n" );
print( " name='selectedI tems[]'>\n" );
//Grab values if the information was found
$in_total_count = $objRSIssueBato rd->RecordCount( );
$counter = 0;
if ($in_total_coun t > 0) {
//Now put in an entry for every value in the batting order list:
//Get the recordset ready and extract data:
$objRSIssueBato rd->MoveFirst();
while (!($objRSIssueB atord->EOF)) {
$counter ++;
//Get the variables and make string to describe items
$in_paper_id = $objRSIssueBato rd->fields("bip_pa per_tracker_id" );
$is_jsp = $objRSIssueBato rd->fields("jsp_co de");
$is_customer_no = $objRSIssueBato rd->fields("pap_cu stomer_no");
if (!$is_customer_ no) $is_customer_no = "N/A";
$is_author = $objRSIssueBato rd->fields("pap_au thor");
if (!$is_author) $is_author = "N/A";
$is_batord_item = $is_jsp." - Paper No. ".$is_customer_ no." -
Author: ".$is_autho r;
//Now list the existing items:
print( " <option value='".$in_pa per_id."'>\n" );
print( " ".$is_batord_it em."\n" );
print( " </option>" );
$objRSIssueBato rd->MoveNext();
}
print(" </select></td>");*/
Can anyone tell me how I can grab the items in the NEW order?
Otherwise it seems a little pointless to be able to change the order
in the first place (using Javascript) if you can't actually make use
of these changes!
I'm trying to emulate part of our client-server application as a web
site so customers can use it, and I'm stuck when it comes to
re-ordering items in a list.
Basically we have a list of available articles ("availableItem s") and
a list of articles already in an issue ("selectedItems "). What I want
is to be able to move articles freely between the two lists and then
on submission add them to the issue (which I can), but also move items
in the "selectedIt ems" list around so that they can be re-ordered
(i.e. I want the customers to be able to change the order in which the
articles appear in the issue).
I can do both these things on screen (i.e. I have written Javascript
to move them from one box to the other (add/delete them from
"selectedItems" ) and to move individual articles up or down the list
of articles in the issue. Befor submitting I run a Javascript loop on
the list to select them all, from top to bottom. On screen it always
selects them in the right order (i.e. top to bottom, no matter whether
I have changed the order of these items) but when I grab the array
containing the item id numbers it's as if the change in order had
never happened!!!
Newly added or deleted papers get added/deleted fine, but when I fetch
the array from "selectedIt ems" I always end up with the items in the
same order, with the latest items added at the end. However, being
able to change the order of these items is crucial for this project,
but so far I have been unable to do this and I haven't found any
information on how to grab the new ORDER of items.
Here's some of the code:
I retrieve the array like this:
/*
$ia_items_new = $_POST['selectedItems'];
*/
However, this still lists the items in the OLD order:
/* if ($ia_items_old) {
foreach($ia_ite ms_old as $key => $value) {
//echo("<BR>Old: No.".$key." - ".$value);
}
}
/*
Populating the "selectedIt ems" box:
/*
print( " <td><select multiple size='20' \n" );
print( " id='selectedIte ms' \n" );
print( " name='selectedI tems[]'>\n" );
//Grab values if the information was found
$in_total_count = $objRSIssueBato rd->RecordCount( );
$counter = 0;
if ($in_total_coun t > 0) {
//Now put in an entry for every value in the batting order list:
//Get the recordset ready and extract data:
$objRSIssueBato rd->MoveFirst();
while (!($objRSIssueB atord->EOF)) {
$counter ++;
//Get the variables and make string to describe items
$in_paper_id = $objRSIssueBato rd->fields("bip_pa per_tracker_id" );
$is_jsp = $objRSIssueBato rd->fields("jsp_co de");
$is_customer_no = $objRSIssueBato rd->fields("pap_cu stomer_no");
if (!$is_customer_ no) $is_customer_no = "N/A";
$is_author = $objRSIssueBato rd->fields("pap_au thor");
if (!$is_author) $is_author = "N/A";
$is_batord_item = $is_jsp." - Paper No. ".$is_customer_ no." -
Author: ".$is_autho r;
//Now list the existing items:
print( " <option value='".$in_pa per_id."'>\n" );
print( " ".$is_batord_it em."\n" );
print( " </option>" );
$objRSIssueBato rd->MoveNext();
}
print(" </select></td>");*/
Can anyone tell me how I can grab the items in the NEW order?
Otherwise it seems a little pointless to be able to change the order
in the first place (using Javascript) if you can't actually make use
of these changes!
Comment