Drag-n-Drop Sorting Demo [v0.5] - CodeStore.net

UK News Snippets for Monday 20th Feb 2006

News Items (Add New)

To re-order the News Items simply drag them up/down until you have the order you require.

  • 1 - (02/24/2008 04:27:56 AM)
    drag($article['Article']['id'],array('revert'=>true)); /* the revert thing will make the draggable return to it's original position. Set this to false and the object will stay where you put it. This does not have anything to do with a function call being made btw, that's the job for the draggables */?>
    requestAction('/controller/showcart'); /* this call is not necessary. You can use it to fill the
    with some content to start with */ ?>
    dropRemote('cart',null,array('url' => '/controller/addarticle/','with'=>'{draggedid:element.id}','update'=>'cart')); echo $ajax->dropRemote('thrashbin',null,array('url' => '/controller/removearticle/','with'=>'{draggedid:element.id}','update'=>'cart')); /* these two calls make objects with DOM id's 'cart' and 'thrashbin' droppable. When an object is dropped into them, the actions defined by 'url' are called. The 'with'=>'{draggedid:element.id} passes the id of the dropped element to the function that is called (on the background, no page refresh or anything like that!). The update thing makes sure that the entire output of the requestAction call is displayed inside the
    So that means that the page will update the part of the page which is specified (dom id 'cart') when the output from the requestAction call is received */ ?>
    drag($article['Article']['id'],array('revert'=>true)); /* the revert thing will make the draggable return to it's original position. Set this to false and the object will stay where you put it. This does not have anything to do with a function call being made btw, that's the job for the draggables */?>
    requestAction('/controller/showcart'); /* this call is not necessary. You can use it to fill the
    with some content to start with */ ?>
    dropRemote('cart',null,array('url' => '/controller/addarticle/','with'=>'{draggedid:element.id}','update'=>'cart')); echo $ajax->dropRemote('thrashbin',null,array('url' => '/controller/removearticle/','with'=>'{draggedid:element.id}','update'=>'cart')); /* these two calls make objects with DOM id's 'cart' and 'thrashbin' droppable. When an object is dropped into them, the actions defined by 'url' are called. The 'with'=>'{draggedid:element.id} passes the id of the dropped element to the function that is called (on the background, no page refresh or anything like that!). The update thing makes sure that the entire output of the requestAction call is displayed inside the
    So that means that the page will update the part of the page which is specified (dom id 'cart') when the output from the requestAction call is received */ ?>
  • 2 - a (02/03/2015 02:01:05 AM)
    a
  • 3 - test fb (04/07/2015 10:06:27 AM)
    test fb
  • 4 - gggg (09/05/2011 08:46:49 PM)
    ggg
  • 5 - testdada (11/22/2011 02:57:46 AM)
    rti.addNewLine(2); // Create table with 4 rows and 3 columns RichTextParagraphStyle rtps = session.createRichTextParagraphStyle(); rtps.setLeftMargin(0); rtps.setFirstLineLeftMargin(0); rtps.setRightMargin( (int)(RichTextParagraphStyle.RULER_ONE_INCH * 1.5)); Vector styles = new Vector(); for (int i = 0; i < 3; i++) { styles.addElement(rtps); } rti.appendTable(4, 3, null, (int)(Ri
  • 6 - aaa (09/18/2014 09:05:26 PM)
    xxx
  • 7 - aaa (11/05/2016 01:33:30 PM)
    scdc
  • 8 - test fb2 (04/07/2015 10:06:41 AM)
    test fb2
  • 9 - asfas (06/12/2010 05:52:19 PM)
    fasf
  • 10 - 333333333333 (05/25/2012 03:35:20 PM)
    4444444444444444444
  • 11 - popo (05/09/2011 07:29:31 AM)
    lolo
  • 12 - aatest (04/19/2013 02:38:20 AM)
    19apr13es
  • 13 - tyhhh (07/28/2014 01:55:17 PM)
    ggfg
  • 14 - a (08/01/2012 03:14:56 AM)
    adsfa
  • 15 - cacca (03/02/2012 10:09:04 AM)
    cacca
  • 16 - 1111111111111111111 (05/25/2012 03:34:32 PM)
    2222222222222222222222222222222
  • 17 - 001 (12/14/2011 12:59:33 PM)
    00100100100
  • 18 - Fish (08/23/2011 04:54:07 AM)
    I LIKE FISH!!!
  • 19 - 1 (05/03/2012 05:15:54 AM)
    1
  • 20 - b v (11/13/2013 03:41:14 AM)
    b v
  • 21 - voici ce qui est (04/27/2011 02:19:34 PM)
    et ce qui sera
  • 22 - kjnkh (01/04/2012 10:18:35 AM)
    h
  • 23 - mi Prueba (03/29/2013 11:29:20 PM)
    Aqui voy a escribir cualquier informacion que me permita validar el ejemplo.
  • 24 - manjeera (10/23/2013 04:08:02 AM)
    test
  • 25 - test (05/09/2012 09:44:56 AM)
    test
  • 26 - sdfsdfsdf (02/23/2011 07:26:53 AM)
    dsfg dsfgsdfg
  • 27 - micca 1234 (03/08/2013 04:37:19 AM)
    ssss
  • 28 - szser (07/25/2011 05:08:39 PM)
    tg45twe
  • 29 - test (07/06/2011 01:05:16 PM)
    mdsk*fmksdfklmsfklms
  • 30 - xsa (04/12/2011 07:57:31 AM)
    xsaxsa
  • 31 - Test 2 (03/18/2009 10:40:35 AM)
  • 32 - fdhdfh (05/16/2011 08:25:23 AM)
    dfhdfhd
  • 33 - dfsdfsd (09/27/2011 08:39:15 AM)
    dsfsdf
  • 34 - к2кцук (06/02/2011 09:13:17 AM)
    цукцук
  • 35 - eyery (05/16/2011 08:25:07 AM)
    ryery
  • 36 - test (02/22/2011 07:13:24 AM)
    tessst
  • 37 - test test (03/23/2011 12:20:53 PM)
    Hello world
  • 38 - arunabha (10/07/2010 01:05:27 AM)
    He is a good boy.
  • 39 - Test (04/12/2011 07:59:15 AM)
    This's my test
  • 40 - blah (03/23/2011 11:38:50 AM)
    Hello world
  • 41 - test (04/21/2011 01:23:05 PM)
  • 42 - ade (04/07/2011 12:45:59 PM)
    xsew
  • 43 - Jayaram (03/10/2011 04:03:33 PM)
  • 44 - erret (12/09/2010 02:25:25 PM)
    retret
  • 45 - hhhh (12/10/2008 09:58:16 PM)
    hhhh
  • 46 - SaradaPrasad (02/24/2011 06:20:35 AM)
    Hi How are u
  • 47 - DDD (05/06/2011 05:02:55 PM)
    DDD
  • 48 - hsdfgsdf (03/17/2011 03:04:55 PM)
    gsdfg
  • 49 - xsax (04/12/2011 07:58:08 AM)
    saxsxsa
  • 50 - sdsd (07/26/2010 05:12:08 AM)
    sdsdsdsd
  • 51 - test 2 (08/13/2010 12:23:29 PM)
    body
  • 52 - rturt (01/06/2011 09:01:43 AM)
    urturtu
  • 53 - zaz (04/26/2011 10:00:18 AM)
    azaz
  • 54 - AAAABBBB (11/17/2010 09:00:21 AM)
    ABC
  • 55 - manish (01/31/2011 04:51:01 AM)
    test
  • 56 - testok (07/20/2010 12:23:23 PM)
    test
  • 57 - Test (01/21/2011 01:39:56 PM)
    Prueba de funcionamiento de la aplicacion
  • 58 - c (12/14/2010 03:20:40 PM)
    cx v
  • 59 - 222 (09/03/2010 03:12:19 AM)
    22
  • 60 - zfgn (11/30/2010 08:00:46 AM)
    x fnxf jnx jmtm
  • 61 - fsdfsd (10/26/2010 12:09:32 PM)
    sfsdfs
  • 62 - qwwe (10/28/2010 06:04:02 AM)
    qe
  • 63 - Amma (01/04/2011 06:11:45 AM)
    TCS
  • 64 - testing mail (02/24/2010 11:37:13 AM)
    hi all
  • 65 - HoHo (09/16/2010 03:15:00 PM)
    Oo
  • 66 - adriano (09/10/2010 03:02:53 AM)
  • 67 - Abhisek (10/07/2010 01:13:32 AM)
    Good Morning
  • 68 - sdfg (12/01/2010 08:47:18 AM)
    sdgsdfg
  • 69 - SAM (07/24/2010 07:59:30 PM)
    call him at 12am
  • 70 - Testomini (07/13/2010 06:36:06 AM)
    Toostoo
  • 71 - 123 (07/09/2010 07:56:53 AM)
    123
  • 72 - sa (08/17/2010 03:05:19 AM)
    sa
  • 73 - sfsd (03/02/2010 09:52:38 PM)
    fdsf
  • 74 - test by ton (05/06/2010 02:09:08 AM)
    my name is tong
  • 75 - reerr (09/21/2010 07:45:03 PM)
    rrrrrrr
  • 76 - wqqwq (04/27/2010 07:14:01 AM)
    assaa
  • 77 - dddddd (05/31/2010 11:29:42 AM)
    ddddd
  • 78 - ghhhh (05/07/2010 09:10:28 AM)
  • 79 - devesh (01/14/2010 11:11:55 PM)
    hellp
  • 80 - Drag'n Drop (06/14/2010 01:31:31 PM)
    goood :)
  • 81 - rr (04/29/2010 02:51:09 PM)
    mm
  • 82 - ee (04/16/2010 03:30:38 AM)
    ee
  • 83 - sfsf (10/22/2009 11:12:01 AM)
    werwer
  • 84 - gadfg (03/18/2010 09:06:43 PM)
    sdfsadf
  • 85 - a (02/03/2015 02:01:03 AM)
    a
  • 86 - Test Add (09/04/2009 12:52:01 AM)
    this is a test...
  • 87 - 特色t (10/22/2009 03:07:41 AM)
    上的发生地
  • 88 - TNE (01/15/2009 03:24:11 AM)
    www.topdanmar.dk
  • 89 - test (05/04/2010 10:17:18 PM)
    test
  • 90 - qqq (06/28/2010 09:18:56 PM)
  • 91 - pizza (02/05/2009 09:43:47 AM)
    pizzahut
  • 92 - vk (02/05/2010 03:47:55 AM)
    vk
  • 93 - 55 (06/12/2009 02:18:57 AM)
    55
  • 94 - Poopy (02/23/2010 08:19:39 PM)
    Poopy.
  • 95 - testsam (07/12/2010 07:36:04 AM)
    asdfasdfdf
  • 96 - cvbcv (01/17/2010 09:35:42 AM)
    cvb
  • 97 - Jar (09/26/2010 03:26:29 PM)
    this is sooooooooo cool
  • 98 - teste (05/23/2009 11:20:45 PM)
    dsdsdsd
  • 99 - Prova (09/16/2009 12:13:29 PM)
    Prova
  • 100 - Teste (04/20/2010 09:04:48 PM)
    Teste

I know what you're thinking. How do I know the documents have really been updated in the database? Well, to prove this, move an item in the list. The message will say the update has taken place. Now refresh the browser page. Notice how the items retain the order you gave them and that the sort number for each one updates.

If Ajax doesn't work for you use this button instead

Note: When new children are added they get given a default sort order of "0". They will remain at the top and will be sorted by date added (most recent at top). It's not until you next (first?) force an update that these new children get given a real order.