• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Valence.util.download

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Valence.util.download

    I used the autocode file maintenance as a base for a new app and I put on a date select next to the search. The date selection of data works as expected, but the download button will not bring back any data when I have a date selected. Do I need to add this date parm to some utility? I kind of get this thing now. Need to figure out how to send the extra param when the button is clicked.

    Thanks
    Last edited by JosephHarriman; 01-13-2016, 09:00 AM.

  • #2
    Since the proxy's extraParams are being passed to the Valence.util.download function when the download button is clicked, you might be best served mimicking the way the search field contents are appended to the extraParams for the store whenever the search text is changed. So something like this inside the "change" listener function handling your date field should accommodate both the main grid load and the download, sending "date" to the RPG program:

    Ext.getStore('Main').getProxy().extraParams.date = value; // (where value is the date value passed on change event)

    Comment


    • #3
      In the Main controller I have this, and bringing back only one day of data works great. When I click on the download icon I get an empty excel. If I hard code d.datesearch = '2016-01-13' in the onDownloadButtonClick then I get back one day in the excel.

      Code:
          onDatefieldChange: function(field, newValue, oldValue, eOpts) {
              Ext.getStore('Main').getProxy().extraParams.datesearch = field.getValue();
                  Ext.ComponentQuery.query('#filegrid #pagingtoolbar')[0].getStore().loadPage(1);

      Comment


      • #4
        What you have there should work fine. Have you looked in DevTools (network tab) to see what exactly is being passed to the back-end?

        Comment


        • #5
          I guess that I will have to start using Chrome for debugging. Did not see this using Firebug. My date select sends the datesearch param as '2016-10-04' and the download sends it as 'Thu Jan 14 2016'. Thanks for mentioning DevTools.

          Comment


          • #6
            Yep, that's a good way to go. You could probably use field.getValue().toISOString(), or just newValue.toISOString(), to get it in a useable format for the back end.

            Comment


            • #7
              Thanks Robert, the field.getValue().toISOString() worked beautifully.

              Comment

              Working...
              X