Announcement

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

    Get the value of a DS field bounded to XML

    Hi all,

    I'm using SmartGwt v2.2.

    My problem is i have a Grid with 2 Fields, one should have a Tree, and the other one the values of each tree node.
    I am using a DS to extract those values from a XML. Problem is i can't get the values out of the DS. Is there a way to get the value of a given field?

    I tried statisticsDS.getField("dataSourcesIdExtracted"), but from here i can't get the field's value only it's name.

    Anyone can help?

    My DS code is:

    public RepoxStatisticsDS() {

    setID("statisticsList");
    setRecordXPath("/repox-statistics");
    DataSourceIntegerField pkField = new DataSourceIntegerField("itemID");
    pkField.setHidden(true);
    pkField.setPrimaryKey(true);

    DataSourceTextField nameField = new DataSourceTextField("dataSourcesIdExtracted", "dataSourcesIdExtracted", 128, true);
    DataSourceTextField dataSourcesIdGeneratedField = new DataSourceTextField("dataSourcesIdGenerated", "dataSourcesIdGenerated", 128, true);
    DataSourceTextField recordsField = new DataSourceTextField("records", "Records", 128, true);
    recordsField.setValueXPath("countriesRecords/countryRecords/records");

    setFields(pkField, nameField, dataSourcesIdGeneratedField, recordsField);

    setDataURL("data/repoxStatistics.xml");
    setClientOnly(true);
    }

    #2
    No one can help? :x

    Comment


      #3
      You can't get value from DataSource directly. DS is a kind of data stream definition.
      You may want to attach DS to the ListGrid or DynamicForm:
      listGrid.setDataSource(ds);
      listGrid.fetchData();
      or fetch data and get response:
      ds.fetchDate(criteria, callback)
      MichalG

      Comment


        #4
        And is there a way to retrieve a given XML field value into a ListGRid RECORD for example?

        Comment


          #5
          listGrid.getRecord(0).getAttribute("dataSourcesIdExtracted")

          Comment

          Working...
          X