Uploaded image for project: 'Spring Roo'
  1. Spring Roo
  2. ROO-2808

Disable Functionality Issue on Filtering Select

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.1.4.RELEASE
    • Fix Version/s: 1.2.0.RC1
    • Component/s: WEB MVC
    • Labels:
    • Environment:
      STS, Tomcat 6.0 , Jackson CodeHaus Json Processor ( jackson-mapper-asl 1.7.1)

      Description

      Hi , i have created an ajax functionality through which i am populating data in my select boxes using ItemFileWriteStore class of Dojo.
      The functionality is that when i click on Author , Books of that Author get Populated.

      Using STS, Tomcat 6.0 , Jackson CodeHaus Json Processor ( jackson-mapper-asl 1.7.1)

      Here is the code

      Code:

      public class Books

      { @NotNull private long id ; private String name; }

      public class Author

      { @NotNull private long id ; private String name ; }

      <field:select field="author" id="com_test_author" itemValue="id" items="${author}" path="/author" />
      <field:select field="books" id="com_test_books" itemValue="id" items="${books}" path="/books" />

      <script type="text/javascript">
      dojo.require("dojo.data.ItemFileWriteStore");
      dojo.addOnLoad(function() {

      var sourceWidget=dijit.byId(_author_id);
      var targetWidget=dijit.byId(_books_id);
      dojo.connect(sourceWidget, "onChange", dojo.partial(customEventHandler,targetWidget));

      function customEventHandler(target,value) {

      dojo.xhrGet({
      url: "books/getBooks",
      handleAs: "json",
      content:

      { id : value }

      ,
      load: function(response, ioargs) {
      console.log(ioargs.xhr.status+"...Succeddds.........:");
      if(response==null)

      { targetWidget.attr("disabled","disabled"); }

      targetWidget.attr("disabled","");
      hanldeResponse(response, ioargs);
      },
      error:function(response, ioargs)

      { console.log(ioargs.xhr.status+"...error.........:"+response); }

      });

      function hanldeResponse(response, ioargs){
      var storeData =

      { identifier:'id', label:'name', items: response }

      ;
      target.displayedValue ='name';
      target.searchAttr ='name';
      target.store = new dojo.data.ItemFileWriteStore(

      {data: storeData}

      );
      }

      }
      });

      From the server side , i am just Returning a Collection of Books

      </script>

      Everything Works fine , i.e. When i change on Author , the particular Authors Books are populated. And when the Response is Null then the Books gets Disabled as i return a null if no Books are found on server side. List<Books> as null. When i change the selection again , some books get populated , but when i press on Submit , a null id of the books , even after selecting the book from the select box , is passed. It can be observed in Tamper data Addon that, in the post , the book id was passed, but at the server side , on debugging no id is received and it throws a NotNull Validation. This happens on When i use the disable functionality Else it works like a charm. Also , i cannot input any data in the Filtering select to match the name once i disable and then re-enable the filtering select box.
      Someone Please Help !

        Attachments

          Activity

            People

            Assignee:
            stewarta Alan Stewart
            Reporter:
            salecharohit Rohit
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2d
                2d
                Remaining:
                Remaining Estimate - 2d
                2d
                Logged:
                Time Spent - Not Specified
                Not Specified