Announcement

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

    Databound Accordian

    I am looking for a databound Accordian. Would it be possible to add databound/datasource functionality to this existing Accordian in order to make sections dynamic from a datasource?

    Or would it be easier to use a Tree and customize the style to look like an Accordian?

    Thanks,

    John Haigh

    #2
    The accordion isn't derived from databound component so no easy way to do it. You would have to modify a lot of code or write your own logic to perform it.

    Comment


      #3
      Not really that hard, for simple databinding you would just eg call fetchData() from your constructor and add sections and other components based on the response. But if you are looking for something that is more tree-like and has built-in load on demand, then yes, you are better off starting from a TreeGrid and using styling to create the appearance of headers.

      Comment


        #4
        Hi,

        Thanks for the pointer on fetchData. Before posting I did some research on the forum, JavaDoc and I did find a couple example but no complete examples with fetchData to get a list of records in the response.

        Could you provide a little more code as I can get the following to compile:

        Criteria c = new Criteria();
        testDS.fetchData(c, new DSCallback() {
        @Override
        public void execute(DSResponse response, Object rawData, DSRequest request) {
        // Error handling
        if (response.getStatus() < 0) {
        //System.out.println(response.getErrors());
        SC.say("Failures!");
        return;
        }

        // Set list grid data
        //carList.setSortField("name");
        //carList.setSortDirection(SortDirection.ASCENDING);
        //carList.setData(response.getData());
        }
        });

        Comment


          #5
          I figured out the issue and here is some working code for anyone else who is looking for a working example:

          final DataSource testDatasource = DataSource.get("testDS");
          testDatasource.fetchData(null, new DSCallback()
          {
          @Override
          public void execute(DSResponse response, Object rawData,DSRequest request)
          {

          Record[] records = response.getData();
          RecordList recordList = response.getDataAsRecordList();

          SC.say("count " + records.length);

          }
          });

          Comment

          Working...
          X