Announcement

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

    fetchrelateddata not working

    Hi
    I use smartgwt 1.2 and gwt 1.7.0
    I have two datasources PodmiotyDS (persons) and RachunkiDS(bank accounts). They are related by foreignkey in RachunkiDS
    PodmiotyDS:
    Code:
    DataSourceIntegerField pkIdPodm = new DataSourceIntegerField("idPodm", "Id Podmiotu" );
    pkIdPodm.setPrimaryKey(true);
    pkIdPodm.setHidden(true);
    DataSourceTextField imie = new DataSourceTextField ("imie",myLocale.dsfPodmiotyName() );
    		imie.setRequired(true);
    		DataSourceTextField nazwisko = new DataSourceTextField("nazwisko", myLocale.dsfPodmiotySurname());
    		nazwisko.setRequired(true);
    		DataSourceDateTimeField dodane = new DataSourceDateTimeField("dodane",myLocale.dsfPodmiotyAdded());
    RachunkiDS:
    Code:
    DataSourceIntegerField pkidRachunku = new DataSourceIntegerField("idRachunku","Id Rach");
    pkidRachunku.setHidden(true);
    pkidRachunku.setRequired(true);
    pkidRachunku.setPrimaryKey(true);
    	
    DataSourceIntegerField fkIdPodm = new DataSourceIntegerField("idPodm","Id Podmiotu");
    fkIdPodm.setHidden(true);
    fkIdPodm.setForeignKey("PodmiotyDS.idPodm");
    DataSourceTextField nrRachunku = new DataSourceTextField("nrRachunku","nr Rachunku test wersji");
    setFields(pkidRachunku,fkIdPodm,nrRachunku);
    when record is selected in grid bounded to PodmiotyDS I call fetchrelatedData method with datasource RachunkiDS

    Code:
    rachGrid.fetchRelatedData(event.getRecord(), rachunkids);
    where:
    Code:
    RachunkiDS rachunkids = RachunkiDS.getInstance();
    The problem is when this happend request for data looks like this:
    Code:
    <request>
      <data>
        <RachunkiDS />
      </data>
      <dataSource>RachunkiDS</dataSource>
      <operationType>fetch</operationType>
      <operationId />
      <startRow>0</startRow>
      <endRow>20</endRow>
      <sortBy />
      <textMatchStyle>exact</textMatchStyle>
      <componentId>Lista_rach</componentId>
      <oldValues />
    </request>
    there is no related idPodm


    in developer console I have found only this:
    Code:
    01:01:09.328:WARN:RestDataSource:RachunkiDS:matched tree relationship field by name: idRachunku
    but I do not know what it means

    I am stuck, do not know what am I doing wrong

    #2
    This is incorrect:

    Code:
    rachGrid.fetchRelatedData(event.getRecord(), rachunkids);
    Pass the users DataSource to the accounts grid so it understands what two entities are to be related. The accounts grid already has the accounts DataSource, but it doesn't know anything about the users DataSource until you pass it.

    Comment


      #3
      Of course ...
      Thanks for your help, it works great now

      Comment


        #4
        Originally posted by Isomorphic
        This is incorrect:

        Code:
        rachGrid.fetchRelatedData(event.getRecord(), rachunkids);
        Pass the users DataSource to the accounts grid so it understands what two entities are to be related. The accounts grid already has the accounts DataSource, but it doesn't know anything about the users DataSource until you pass it.
        Can you tell me how to do that. I have the same issue as this guy but I don't understand your answer. Would it be possible for you to write a snippet code of the idea. Thank you so much.

        Comment


          #5
          Originally posted by lazinskip
          Of course ...
          Thanks for your help, it works great now
          Hi, can you tell me how did you solve this issue. I have the same legend on my developer console. Is just there I don't understand the answer that isomorphic wrote for you.

          Best regards.

          Comment


            #6
            Originally posted by acuellar
            Can you tell me how to do that. I have the same issue as this guy but I don't understand your answer. Would it be possible for you to write a snippet code of the idea. Thank you so much.
            In order to fetch the related data you have to use
            Code:
            referencingTable.fetchRelatedData(record,referencedDataSource)
            not
            Code:
            referencingTable.fetchRelatedData(record,referencedDataSource)
            , assuming that referencingTable is binded to referencingDataSource and referencingDataSource points to referencedDataSource

            Comment

            Working...
            X