Announcement

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

    Displaying data in Listgrid and DynamicForm

    Hello there,

    SmartClient Version: v10.0p_2015-05-08/PowerEdition Deployment (built 2015-05-08) testing on FF26.

    I am trying to display the data I fetch from the database in the listgrid and dynamicForm. I have a datasource file which loads the data in the Listgrid and DynamicForm. Now I have field called name in that datasource and then I have another datasource file where one of the field is called name. Now when I am loading the listgrid both the col are getting filled with this name data. But in the dynamicForm it is putting the correct name in their respective component. How can I tell smartgwt to distinguish these names. I tried displayField,but no luck

    Code:
    <DataSource ID="productDS" serverType="sql" tableName="pdu">
    
     	<fields>
    		<field name="id" type="sequence" hidden="true" primaryKey="true" />
    		<field name="name" title="Product Name" type="ntext" length="128" required="true"/>
    		<field name="code" title="Code" type="integer" required="true"/>
            
    		<field name="dfid" title="Dosage Form" type="integer" foreignKey="dosformDS.id" displayField="name" required="true">
    		</field>
    this is the other datasource file which i am calling in the above datasource file

    Code:
     
    <DataSource ID="dosformDS" serverType="sql" tableName="dfor">
    	<fields>
    		<field name="id" type="sequence" hidden="true" primaryKey="true" />
    		<field name="name" title="Description" type="ntext" required="true"/>
    	</fields>
    </DataSource>
    Attached Files

    #2
    You may be looking for DataSourceField.includeFrom. If not, you'll need to be far more specific about what behavior you expect.

    Comment


      #3
      I have these 2 tables with foreign key relationship.

      Product and dosageform

      Now in the Product table I save the id of the dosageform.

      The raw response for FETCH operation on the productDS looks like so
      {
      affectedRows:0,
      data:[
      {
      slife:24,
      ro:1,
      nirc:333,
      rowID:1,
      status:"Active",
      gtin:6678,
      code:777,
      gcde:557,
      mupck:980,
      fptype:"Others",
      id:1,
      neng:"sdasdasd",
      pgr:2,
      dfid:6,
      name:"ass",
      dcde:990,
      oirc:4457,
      supck:12,
      pu:"Kg",
      nper:"sdsdd"
      }
      ],
      endRow:1,
      invalidateCache:false,
      isDSResponse:true,
      operationType:"fetch",
      queueStatus:0,
      startRow:0,
      status:0,
      totalRows:1
      }

      this data i show in the ListGrid {
      affectedRows:0,
      data:[
      {
      slife:24,
      ro:1,
      nirc:333,
      rowID:1,
      status:"Active",
      gtin:6678,
      code:777,
      gcde:557,
      mupck:980,
      fptype:"Others",
      id:1,
      neng:"sdasdasd",
      pgr:2,
      dfid:6,
      name:"assee",
      dcde:990,
      oirc:4457,
      supck:12,
      pu:"Kg",
      nper:"qq"
      }
      ],
      endRow:1,
      invalidateCache:false,
      isDSResponse:true,
      operationType:"fetch",
      queueStatus:0,
      startRow:0,
      status:0,
      totalRows:1
      }

      This data I show in the listgrid. Concentrate on these 2 fields

      name:"assee",
      dfid:6,

      Dfid = 6 is the dosageform id which i save in the product table. Now instead of showing the digit 6 to the user(which makes no sense to the user) I have to show the name of it. Which I have linked those two tables in my productS by mentioning

      Code:
      <field name="dfid" title="Dosage Form" type="integer" foreignKey="dosformDS.id" displayField="name" required="true">
      		</field>
      .

      But because in my dosageform DS i have a field called name and then i have this another field in the productDS called name, it is not differentiating that these name field are two different.

      Comment


        #4
        Thanks, it is working now doing this.

        Code:
        <field name="dfid" title="Dosage Form" type="integer" foreignKey="dosformDS.id" includeFrom = "dosformDS.name" required="true"></field>

        Comment

        Working...
        X