DWR

Binding of nested properties doesnt work.

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 2.0.rc1
  • Component/s: Util
  • Description:
    Hide
    Binding of nested properties doesnt work.

    See details here http://www.nabble.com/support-for-nested-properties-tf1949563.html

    ------- Additional comments from sjivan Wed Jul 19 01:41:30 +0000 2006 -------

    Created an attachment (id=9)
    modified util.js file which carries out binding as outlined in Joe's email

    ------- Additional comments from sjivan Wed Jul 19 01:53:19 +0000 2006 -------

    Created an attachment (id=10)
    tests

    ------- Additional comments from sjivan Sun Dec 10 16:56:04 +0000 2006 -------

    A bug was reported with the assignment of multiple select options
    http://www.nabble.com/RE%3A--setValues-for-multiple-select---doesnt-work-anymore-tf2769099.html

    Basically when trying to set multiple values of a select field via DWRUtil.setValues(selectField, ['option1', 'option3']), the call did not set the options 'option1' and 'option3'. However setting a single option by passing a non array single value like DWRUtil.setValues(selectField, 'option3') worked.

    The issue was with with the check

    if (map[property] != null && typeof map[property] == "object") {

    in dwr.util._getDataProperties where a test was being made to see if the call is trying so set a nested property. The check typeof map[property] == "object" passes even when the property value is an array however for the nested property code to be invoked, the proerty value should be a data object and not an array as arrays apply to multi select fields.

    The following fixes the issue.

    dwr.util._isArray = function (o) {
        return isObject(o) && o.constructor == Array;
    }

    dwr.util._isDataObject = function (o) {
        return (o && typeof o == 'object');
    }

    dwr.util._getDataProperties = function(map, prefixes) {
      for (var property in map) {

    -- /*if (map[property] != null && typeof map[property] == "object") {*/

    ++ if (map[property] != null && dwr.util._isDataObject(map[property]) && !
    dwr.util._isArray(map[property]) ) {

    Attaching an updated test case which has multi selects.


    ------- Additional comments from sjivan Sun Dec 10 16:57:27 +0000 2006 -------

    Created an attachment (id=13)
    updated test case which has multi select binding

    ------- Additional comments from sjivan Sun Dec 10 17:01:38 +0000 2006 -------

    Can an admin update the example on http://getahead.ltd.uk/dwr/browser/util/setvalues
    to include a multi select and also have the default value of the args to setValues include the multi select. eg :

    {
      div: "new div content",
      password: "1234567890",
      select: ['value two', 'value three']
    }

    It will also be nice if a sample of the nested proeprties (liek the one I attached) is made available online.
    Show
    Binding of nested properties doesnt work. See details here http://www.nabble.com/support-for-nested-properties-tf1949563.html ------- Additional comments from sjivan Wed Jul 19 01:41:30 +0000 2006 ------- Created an attachment (id=9) modified util.js file which carries out binding as outlined in Joe's email ------- Additional comments from sjivan Wed Jul 19 01:53:19 +0000 2006 ------- Created an attachment (id=10) tests ------- Additional comments from sjivan Sun Dec 10 16:56:04 +0000 2006 ------- A bug was reported with the assignment of multiple select options http://www.nabble.com/RE%3A--setValues-for-multiple-select---doesnt-work-anymore-tf2769099.html Basically when trying to set multiple values of a select field via DWRUtil.setValues(selectField, ['option1', 'option3']), the call did not set the options 'option1' and 'option3'. However setting a single option by passing a non array single value like DWRUtil.setValues(selectField, 'option3') worked. The issue was with with the check if (map[property] != null && typeof map[property] == "object") { in dwr.util._getDataProperties where a test was being made to see if the call is trying so set a nested property. The check typeof map[property] == "object" passes even when the property value is an array however for the nested property code to be invoked, the proerty value should be a data object and not an array as arrays apply to multi select fields. The following fixes the issue. dwr.util._isArray = function (o) {     return isObject(o) && o.constructor == Array; } dwr.util._isDataObject = function (o) {     return (o && typeof o == 'object'); } dwr.util._getDataProperties = function(map, prefixes) {   for (var property in map) { -- /*if (map[property] != null && typeof map[property] == "object") {*/ ++ if (map[property] != null && dwr.util._isDataObject(map[property]) && ! dwr.util._isArray(map[property]) ) { Attaching an updated test case which has multi selects. ------- Additional comments from sjivan Sun Dec 10 16:57:27 +0000 2006 ------- Created an attachment (id=13) updated test case which has multi select binding ------- Additional comments from sjivan Sun Dec 10 17:01:38 +0000 2006 ------- Can an admin update the example on http://getahead.ltd.uk/dwr/browser/util/setvalues to include a multi select and also have the default value of the args to setValues include the multi select. eg : {   div: "new div content",   password: "1234567890",   select: ['value two', 'value three'] } It will also be nice if a sample of the nested proeprties (liek the one I attached) is made available online.
  1. dwrtest.html
    (3 kB)
    Joe Walker
    12/Apr/07 12:31 PM
  2. dwrtest.jsp
    (3 kB)
    Joe Walker
    12/Apr/07 12:32 PM
  3. util.js
    (31 kB)
    Joe Walker
    12/Apr/07 12:30 PM

Activity

Hide
Joe Walker added a comment - 12/Apr/07 12:30 PM

modified util.js file which carries out binding as outlined in Joe's email

Show
Joe Walker added a comment - 12/Apr/07 12:30 PM modified util.js file which carries out binding as outlined in Joe's email
Hide
Joe Walker added a comment - 12/Apr/07 12:31 PM

tests

Show
Joe Walker added a comment - 12/Apr/07 12:31 PM tests
Hide
Joe Walker added a comment - 12/Apr/07 12:32 PM

updated test case which has multi select binding

Show
Joe Walker added a comment - 12/Apr/07 12:32 PM updated test case which has multi select binding
Hide
Mike Wilson added a comment - 13/Apr/07 10:16 PM

Was fixed in several iterations during 2006.

Show
Mike Wilson added a comment - 13/Apr/07 10:16 PM Was fixed in several iterations during 2006.

People

Dates

  • Created:
    12/Apr/07 12:28 PM
    Updated:
    29/Feb/08 10:29 AM
    Resolved:
    13/Apr/07 10:16 PM