• Sviatlana Andryianchyk
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 1
    Replies
Hi,
I am trying to export resurls of my apex function into excel file using alasql library. But this functionality is quite unstable: sometimes it generates file for download, sometimes just overloads page.
This is my VF page:
 
<script>
function exportReport() {
             Visualforce.remoting.Manager.invokeAction(
                        '{!$RemoteAction.AdministrationController.getRemoteAreaData}', chartInterval,
                        function(result, event) {
                            alasql('SELECT * INTO XLS("CallsReport.xls",?) FROM ?', [chartData, result]);
                        });
            }
            //Column header title and field values bind with that header of report
            var chartData = {
                headers:true,
                columns: [
                    { columnid: 'name', title: 'Date'},
                    { columnid: 'incoming', title: 'Incoming'},
                    { columnid: 'outcoming', title: 'Outcoming'},
                ],
            };
</script>

<apex:commandButton value="Download Reports" onclick="exportReport();" style="margin-top:15px; width: 100%"/> 
Here what is happening in the controller:
@RemoteAction
    global static List<AreaDataWrapper> getRemoteAreaData(String interval) {
        return CallCenterAdministrationController.generateAreaData(interval);
    }
This function returns list of such objects:
 
global class AreaDataWrapper {

        public String name { get; set; }
        public Decimal incoming {
            get;
            set;
        }
        public Decimal outcoming {
            get;
            set;
        }

        public AreaDataWrapper(Decimal incoming, Decimal outcoming, String name) {

            this.name = name;
            this.incoming = incoming;
            this.outcoming = outcoming;
        }
    }
Thank you in advance


 
Hi, I am calling controller function on command button click.

This is button:
<apex:commandButton value="Add" onClick="addItemToCard('{!$Component.bVAL}', '{!item.Id}'); return false;"/>
 
<apex:actionFunction name="addToCardFunction" action="{!addToCard}" reRender="items"> 
    <apex:param name="count" value="" assignTo="{!itemCount}"/> 
    <apex:param name="id" value="" assignTo="{!itemId}"/> 
</apex:actionFunction>

I call controller function in js:
function addItemToCard(itemCountId, id) { 
    addToCardFunction(document.getElementById(itemCountId).value, id); 
}

I don't know why, but my addToCard() controller method is called only in the first time . When I click button second time, nothing happens. Page is just reloaded :(
 
Hi,
I am trying to pass variable value from visualforce page to my custom controller. But it is constantly null.
This is my page:
 
<apex:page id="productCatalog" controller="ItemController">
<table class="table" id="block">
   <apex:repeat value="{! items[key]}" var="item">
       <tr>
          <td class="col-md-2"></td><apex:outputText value="{! item.Name}"/>
          <td class="col-md-2">
             <apex:form >
                 <apex:pageblock >
                     <apex:inputText value="{!myinput}"/>
                     <apex:commandButton value="Submit" reRender="outputID" action="{!MyMethode}"/>
                 </apex:pageblock>
             </apex:form>
          </td>
       </tr>
    </apex:repeat>
</table>
</apex:page>
And tis is my controller:
public with sharing class ItemController {
 public string myInput{get;set;}

    public void MyMethode(){
        System.debug(myInput);
}
When I place form element out of the repeat block, everything works ok. But now the value of myInput is constantly null. Thank yoy in advance!


 
Hi
I am using two kind of objects: Item and Category. They are linked via junction table CategoryItem. So, how to select objects into Map<Category, Item[]>. This map should contain array of items under each category. Thank you in advance.
Hi
I am using two kind of objects: Item and Category. They are linked via junction table CategoryItem. So, how to select objects into Map<Category, Item[]>. This map should contain array of items under each category. Thank you in advance.
Hi, I am calling controller function on command button click.

This is button:
<apex:commandButton value="Add" onClick="addItemToCard('{!$Component.bVAL}', '{!item.Id}'); return false;"/>
 
<apex:actionFunction name="addToCardFunction" action="{!addToCard}" reRender="items"> 
    <apex:param name="count" value="" assignTo="{!itemCount}"/> 
    <apex:param name="id" value="" assignTo="{!itemId}"/> 
</apex:actionFunction>

I call controller function in js:
function addItemToCard(itemCountId, id) { 
    addToCardFunction(document.getElementById(itemCountId).value, id); 
}

I don't know why, but my addToCard() controller method is called only in the first time . When I click button second time, nothing happens. Page is just reloaded :(