Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    listgrid Optiondata source

    Hello,
    I am using SC 8 (jan 5th version).

    I am trying to display the value from a different datasource. When I display only one value it displays the correct value. But when I put 2 columns it does not display correct.

    Code:
    {name: "zone_id", align: "left", title: "Zone name",  required: true,
    		        	 valueField: "zone_id",
    		        	 displayField: "zone_name",
    		        	 optionDataSource:"customDS_zone",
                         showHover:true,hoverHTML:"return phoneList.getCellValue(record, rowNum, 0);"},
    works, but not
    Code:
    {name: "zone_id", align: "left", title: "Zone name",  required: true,
    		        	 valueField: "zone_id",
    		        	 displayField: "zone_name",
    		        	 optionDataSource:"customDS_zone"},
    {name: "zone_id", align: "left", title: "Address",  required: true,
    		        	 valueField: "zone_id",
    		        	 displayField: "address1",
    		        	 optionDataSource:"customDS_zone"
    },
    Is there any way to display the value of multiple fields in the displayField since the field I need is only a read-only field.

    thanks,
    ~S

    #2
    Hi Susan
    The problem with this code is that it is invalid to have 2 fields with the same name in a ListGrid.
    There are various ways you could solve this. One would give the second field a different name and override field.getCellValue() to pick up the 'zoneID' property for the record [which would then be converted to the display field of the option dataSource].
    Another would be to combine the data yourself, either having your dataSource combine the data on the server side (easy to achieve via customSQL if you're using the SmartClient server), or perform a fetch against the option dataSource on the client and use that to build a couple of valueMaps to apply to the field.

    Comment

    Working...
    X