Announcement

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

    Dynamic datasource

    We are working on hard industry level product.
    One of our app modules is equipment catalog that contains tree-structure of dozens on object-types in it

    Oracle DB is allredy done and cannot be changed and working whole on procedures and stored functions.

    I have two functions package.data(objkey) and package.meta(objkey), where objkey points to some catalog-tree leaf with one-type objects.

    first one returns me a table with f1....fn columns with values, and second one returns me a caption,type,fieldname

    now i made 2 queries - one fields(fetch datasource and parse records on datarived to generate fields) and second for values, both client-side controled

    is there a way to feed listgrid with ONE dynamic datasource with fields information that prepared on server(or client side)?

    #2
    You may be looking for Queuing or for Dynamic DataSource Generators. For both, see the QuickStart Guide. If that doesn't answer your question, try to be more specific.

    Comment


      #3
      thanx for advice

      I'll check it tomorrow.

      Comment


        #4
        no luck

        I created implementer of DynamicDSGenerator.

        added it as

        Code:
        DataSource.addDynamicDSGenerator(new ObjListDynamicDmi(dataSource), "dynamic_");
        Method getDataSource(String s, DSRequest dsRequest) has called for first time on page load, when it required by DataSourceLoader.

        in that time I have dsRequest = null and returning some dummy fieldless ds

        On runtime when my ListGrid requires data, it fetching my ds with come criteria.

        Code:
        getObjectGrid().setDataSource(DataSource.get("dynamic_objList"));
                getObjectGrid().fetchData(new Criteria("nodename", nodename));
        AutoFetching data is disabled on creation of grid

        Depending on that criteria my DSGenerator generates new xml string with fields definition and calls for
        Code:
        DataSource result = DataSource.fromXML(xml.toString());
                    return result;
        where xml is StringBuffer.

        Althrought generator is get called every time, field information is not updating, if i declare some fields in my first dummy ds - I will see them, but not newly generated fields.
        http://clip2net.com/s/2RfDc
        Its DataSource that returning from generator, it has normaly parsed xml and has info on fields.

        What am I doing wrong?

        Comment


          #5
          It looks like you are expecting that somehow your new definition is going to be delivered to the client along with the DSResponse. This doesn't happen. Your DataSource definition is delivered to the client when you use the DataSourceLoader (either via a <script> tag or via DataSource.load()) and not at any other time.

          Comment


            #6
            any solution?

            What is suggested solution to show ListGrid with dynamic changing fields?

            Comment


              #7
              ?

              You can use Dynamic DataSources for this, just don't expect DataSource definitions to be implicitly loaded when sending back a DSResponse.

              Comment


                #8
                Any example?

                How can I load DataSource definitions that depends on criteria I providing for fetchData?

                Again - on server side I have Oracle 11g, I call stored functions:

                Package.getMeta(objKey) - receive field definition [caption, name, type] of each column, where name is f1,f2,f3,f4..... is from 8 to 25 columns;

                Package.getData(objKey) - receive [f1,f2,f3,f4.....] of each row

                So I need to build fields from first function and then get data from second.

                Comment


                  #9
                  It looks like you have a DataSource per objKey.

                  So just do a DataSource.load(objKey) to get the dynamic datasource and then perform a fetch on it which if configured correctly by the generator will hit Package.getData(objKey).

                  Comment


                    #10
                    Big thanks!

                    You saved my life, davidj6!

                    Few question more:

                    We estimated about huge number simultaneous connections to our system. Althrought we have only one such datasource for now, there no any guarantee that ther will not be few more.

                    - is there a performance impact on server and client using dynamicly generated DS in this way?

                    - do I need to cache generated xml's/datasources in order to lower server/db load or there some built-in mechanisms?

                    Comment


                      #11
                      Glad to help.

                      Client performance is fine because DataSource.load will not contact the server if the data source has already been loaded.

                      On the server if you will be having a lot of dynamic datasources or if the time or load to create them is large I would cache them. I have done that on a previous project.

                      From your description I gather your data sources will share the same server class (either automatic or custom) so I don't see an issue there either.

                      In the end using dynamic datasources is not really different from pre-defined .ds.xml ones. It just allows use of another layer of metadata.

                      Comment

                      Working...
                      X