Announcement Announcement Module
Collapse
No announcement yet.
Spring roo and ajax / push notifications Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring roo and ajax / push notifications

    Hello everyone. I'm basically done with my spring roo project, I just need one final requiremend done.
    I have a Alarm entity and properly set all the crud / list all / finders code. What I'd need to wrap everything is to integrate the list_all view with ajax / push updates, something like the Facebook news updates.
    Basically, I'd like that if a new Alert is raised, it shows up in the list all table without having to refresh the page periodically.
    It's probably not that easy to accomplish, so I don't expect the actual ready-to-use solution, but I'd love it if anyone can pinpoint me in the right direction!
    Thanks,
    Roberto

  • #2
    Originally posted by tylerdurden83 View Post
    I'd love it if anyone can pinpoint me in the right direction!
    Create a query (finder command) and publish it through JSON (json and web mvc json commands) at server.
    Use DOJO for schedule and call query from client.

    Regards !

    Comment


    • #3
      Excellent, I'm gonna start working on it right now, I just wanted to be sure that it was the proper way. I'll post my progresses.

      Have a nice day,
      Roberto

      Comment


      • #4
        Originally posted by mmartinez View Post
        Create a query (finder command) and publish it through JSON (json and web mvc json commands) at server.
        Use DOJO for schedule and call query from client.

        Regards !
        Good day mmartinez and everyone else!
        I've followed your suggestion and did:
        1. Create a query (finder command) and publish it through JSON (json and web mvc json commands) at server.
        2. Use DOJO for schedule and call query from client.
        They both work. I tested the first with curl, and it returns the proper data.
        I also used dojo to do something like this:
        Code:
        <script language="javascript"> 
        		dojo.addOnLoad(function() {
        			dojo.xhrGet({
        		      url: "/jtec-mvc/javatecevts",
        		      preventCache: true,
        		      headers : {
        			        "Content-Type" : "application/json,charset=utf-8"
        			  },
        			  handleAs: "json",
        			  load: function(dataFromServer) {
        				  console.log(dataFromServer);
        		      },
        		      error: function(e) {
        		          console.log("Ajax call failed", e);
        		      }
        			});
        		});	
        	</script>
        which also works. Now I'm lost trying to understand something tho...
        How do I use such data (dataFromServer) to replace the table that is placed inside the div with class="dijitTitlePaneContentInner" that was generated by roo's web scaffolding? Should I add an id to said table and replace it? Do I have to manually loop and split the json data into the right amount of TDs and TRs before replacing the table?
        Thanks a lot,
        Rob

        Comment


        • #5
          Originally posted by tylerdurden83 View Post
          How do I use such data (dataFromServer) to replace the table that is placed inside the div with class="dijitTitlePaneContentInner" that was generated by roo's web scaffolding? Should I add an id to said table and replace it? Do I have to manually loop and split the json data into the right amount of TDs and TRs before replacing the table?
          For me, any of this solutions are valid.
          You can use DOJO too for add/replace a div in page with new server response values.

          Regards !

          Comment


          • #6
            Originally posted by mmartinez View Post
            For me, any of this solutions are valid.
            You can use DOJO too for add/replace a div in page with new server response values.

            Regards !
            Constructing a simple html table inside the dojo.xhrGet isn't really feasible, the table.tagx has the logic (conditionals) and specifics about how to render stuff (for example when looping on items, render the value item.pic with an img tag instead of plain text).
            I need a way for my json retrieved data to reuse the whole jspx / tagx tools that are used by default...

            Comment

            Working...
            X