2 Replies Latest reply: Aug 21, 2016 12:20 PM by Youness Ghanim RSS

    What to pass to qvangular.promise()!?

    Youness Ghanim

      Hello everyone,

       

      Can someone kindly share an example of selectdialog.js    Note sure what to pass to qvangular.promise()

       

      Many thanks

      //Youness

        • Re: What to pass to qvangular.promise()!?
          Thorsten Brandes

          Hello Youness,

          my solution looks like this:

           

          selectdialog.js:

          getPreview: function( /*databaseName, ownerName, tableName*/ ) {

          return serverside.sendJsonRequest("getPreview").then(function (response) {

             return qvangular.promise(response.qPreview);

             });

          }

           

          On the serverside I'm using the Qvx SDK. In the QvxServer I'v overwritten the HandleJsonRequest, which is handling the JsonRequests.

           

             if (method.Equals("getPreview"))

             {

               var result = new PreviewResponse();

               // Store the table Header (my table has two columns)

               var row = new PreviewRow();

              row.qValues.Add("LayerId");

              row.qValues.Add("Layer");

             

               // Store the values

               row = new PreviewRow();

               row.qValues.Add("1");

               row.qValues.Add("Actual");

              

               row = new PreviewRow();

               row.qValues.Add("2");

               row.qValues.Add("Plan");

           

               return result;

             }

           

          The PreviewResponseClass is defined like this:

           

             public class PreviewRow

             {

                 public PreviewRow()

                 {

                      this.qValues = new List<string>();

                 }

           

                public List<string> qValues { get; set; }

             }  

            

             public class PreviewResponse: QvDataContractResponse

            {

                 public PreviewResponse(): base()

                 {

                      this.qPreview = new List<PreviewRow>();

                 } 

           

                 public List<PreviewRow> qPreview { get; set; }

             }

           

           

          I hope that will help you.

          Kind Regards,

          Thorsten