Announcement

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

    OperatioBinding - add serverObject based on conditional

    SmartClient Version: v10.0p_2015-06-10/PowerEdition Deployment (built 2015-06-10)
    Browser Version : IE 11.0.9600.17843

    I have 2 OperatioBinding almost same(same table clause, where clause, select clause), except one is suing serverObject and other one not. Is that we can make it as one based on the condition(from dsRequest) in the DataSource. One idea is we can call with serverObject always and in the DMI we can just dsReques.execute() based on the condition from DsRequest. Is that any other way to customize it in the ds.xml file itself? Looking for avoiding the duplicate code by writing one OperationBinding.

    <operationBinding operationType="fetch" operationId="fetchData">
    <selectClause>DISTINCT $defaultSelectClause</selectClause>
    <tableClause><-- Table_Name 1,2 here --></tableClause>
    <whereClause><-- Condition 1,2 here --></whereClause>
    </operationBinding>

    <operationBinding operationType="fetch" operationId="exportFetchData" serverMethod="downloadData">
    <selectClause>DISTINCT $defaultSelectClause</selectClause>
    <tableClause><-- Table_Name 1,2 here --></tableClause>
    <whereClause><-- Condition 1,2 here --></whereClause>
    <serverObject lookupStyle="new" className="DMIClass"/>
    </operationBinding>

    Thanks in advance
    Last edited by jaikumar; 10 Dec 2015, 10:13.

    #2
    Hi jaikumar,

    I don't think that it is allowed to have two operationBindings with the same operationType and operationId. Perhaps even the operationId alone has to be unique (?).

    Best regards
    Blama

    Comment


      #3
      You haven't actually told us how the two operationBindings should differ in behavior.

      There are a lot of different declarations you can put on an operationBinding that will change it's behavior. The key ones are covered in the QuickStart Guide, then you can look at the JavaDoc for the rest.

      Comment


        #4
        Blama , Sorry the operationId is different but same operationType(fetch).

        Isomorphic : The search criteria is same for both operation binding (whereclause, tableclause... ),

        Difference:
        OperationBinding 1 : No serverObject - The reponse is directly bind with Listgrid. No DMI actions are required.
        OperationBinding 2 : serverObject(DMI) is used to build some business logic and export the data into Excel. Not bind with any Canvas.

        Thanks

        Comment


          #5
          Same question. You want these two to behave differently in some way, and you want to declare the difference in behavior in your .ds.xml.

          So what is the difference in behavior?

          It doesn't help to say that the ultimate destination is Excel.

          Comment


            #6
            The difference is only serverObject used in one operatiobinding. Both are called from different scenario in client. The first one is used to display the ListGrid. The second one is called when Export the listgrid data. We are not using the Export provided by SmartGWT because of some constraints in our application. So we write own POI code in server to Export the data thats created in ListGrid(with full data load).So need to use the same criteria as ListGrid opearation binding. For second case using that criteria get the response in DMI and write poi code to export.

            Comment


              #7
              You still haven't answered the question. We see that you added the ServerObject declaration, that's really obvious.

              The question again is:

              You want these two to behave differently in some way, and you want to declare the difference in behavior in your .ds.xml.

              So what is the difference in behavior?

              Comment


                #8
                I need one operationbinding that will be called from 2 places in client ; one call should not go to DMI class and other second call should go to DMI class. I dont want to write 2 different OperatioBinding as i given in sample. Based on some condition one call should go to DMI and other not.

                For both scenario I can call DMI class and based on the condition I can do or just call execute. I want to know any other way is there to call> I want to use opearationBinding.

                I am not sure I have explained the requirement properly. I dont know what I am missing :(

                Comment


                  #9
                  Last attempt..

                  You're already aware that you could just have a single <operationBinding> that does include the <serverObject> and have your DMI logic just do nothing - just "return dsRequest.execute()" - based on something you put into the dsRequest that your DMI logic can detect - the componentId, some part of the criteria that will only be present for export, whatever.

                  So that's already really simple and it means you have only one operationBinding, not two.

                  You seem to be trying to somehow make this simpler by putting something into the .ds.xml file. We have no idea how any feature in the .ds.xml file could make this scenario simpler. If you have an idea for a simplification, tell us what it is.

                  Comment


                    #10
                    :) Thanks Isomorphic. I will go with that option only.
                    I just want to confirm with the master brains. I am new to this and lot of treasures are available in the SmartGwt and trying to find anything for this. I have to spend time with SmartGwt 5.1 also to get more benefits. Thanks again.

                    Comment


                      #11
                      The "master brains" are happy to help you find features that do what you want.

                      We're just helpless if you can't explain what it is that you want :)

                      Comment


                        #12
                        Thanks. Yes sometime we expect more than available and that's not required also(for this case). But we will correct that, we will try to provide enough/exact details that easy to understand :)

                        Comment

                        Working...
                        X