Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Portlets with jQuery - saving their position

    Hello,

    I am attempting to build a portal, located here:

    http://thinkteen.co.uk/portal

    Currently, the portlets are hard coded into the portal page as can bee seen via the source.

    What I need to be able to do is to:

    • User able to move portlets (achieved)
    • New portlet position to be saved


    So, basically, I have though about making an AJAX request to POST to a PHP file on the server which saves the new position in the MySQL backend.

    IE:

    On widget drop ajax POST to /widget.php with position info(maybe container name + item index) ('leftBar',3), maybe account # that is specific to user, as well as the identifier for the module -->

    Code:
    $.post("widget.php", { module: "myInfoModule", container: 'leftBar'},"json");
    Would that be correct?

    in widget.php, it writes to the database the new position of the widget/portlet.

    Now here's the other thing I need to achieve; to be able to read the modules and position from database, and place them in their respective places.

    I am not entirely sure what to do here.

    Thanks :)

  • #2
    New Coder
    Join Date
    May 2007
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'll give you a tip how I do it, I have 2 columns

    in the DB I store the portlet positions like this 1-1|1-2|1-3|1-4|2-5|2-6 for each user.

    Then on my 2 columns I run some code to detect which numbers are in that row, I then have each portlet in it's own file and the file is named by the number it represents, I then just include the files in the order that they are supposed to show up in


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •