0 Replies Latest reply on Sep 3, 2012 12:03 PM by Christian Peter

    Reducing the number of request parameters using RF 3.3.x

    Christian Peter Expert

      Hello,

       

      My customers would like to have something like inline editing for tables - rich:dataTable, extdt or custom made components. In my simplest approach I've tried to use h:inputText (or other UIInput) components as column content and it worked. But this doesn't scale very well: Our JBoss AS 7.1 has a default cap for request parameters of 512! So you can imagine having 10 columns with input fields and about 60 rows that errors will occur. We could increase the value of maxium req. params, but this would be a security risk I think.

       

      Switching from output to input on selecting a row was my second attempted solution. This actually worked quite well - especially with ajaxKey in use to minimize the number of rerendered components. But this was still to slow. Having a slow and complex application, the roundtrip times were somewhere around 1-2 seconds.

       

       

      Why does every ajax request transmit the data from all input elements of the same form?

       

      I'll try something like this:

       

      $j.fn.input2Span = function(){

                     att={};

                     $j(this[0].attributes).each(function(){

                       att[this.nodeName] = this.nodeValue;

                     });

                     var $span = $j("<span>" + $j(this).val() + "</span>");

       

                     for (at in att) {

                       $span.attr(at, att[at]);

                     }

                     $j(this).replaceWith($span);  

                 }

                

                 $j.fn.span2Input = function(){

                       console.log($j(this));

                     att={};

                     $j(this[0].attributes).each(function(){

                       att[this.nodeName] = this.nodeValue;

                     });

       

                     var $input= $j("<input></input>");

       

                     for (at in att) {

                       $input.attr(at, att[at]);

                     }

                     $j(this).replaceWith($input);  

                 }

       

      to switch from SPAN to INPUT on the client and back. These "inputs" will be ignored and not processed. Are there any disadvantages with this approach?

       

      Next I'll have to set the initial state (render SPAN or INPUT) by creating custom components for all possible input components. :-/