• Christian Cequina
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Programmer
  • JSYS Philippines Inc.


  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi everyone,

​Please help me on this problem.
I develop a VF page that generate an XML. My problem is '&#10;' doesn't work on <Header> and <Footer> tag.
The reason is '&' turns to '&amp;'  in XML . Is there any other way to do this.

Here is the my sample code:

<apex:page controller="MyController" sidebar="false" cache="true" contentType="application/vnd.ms-excel#{!fileTitle}.xls">
  <apex:outputText value="{!XmlHeader}"/>
    <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
              xmlns:o="urn:schemas-microsoft-com:office:office"
              xmlns:x="urn:schemas-microsoft-com:office:excel"
              xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
              xmlns:html="http://www.w3.org/TR/REC-html40">
      
<!---------------------------------- Documentation --------------------------------->
      <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
        <Author>     Salesforce Administrator </Author>
        <Created>    {!TODAY()} </Created>
        <Version>    1          </Version>
      </DocumentProperties>
 
<!----------------------------------------------- Worksheet --------------------------------------------->
    <Worksheet ss:Name="sheet">
        <Table>
            <Column/>
            <Column/>
            <Row>
                <Cell><Data ss:Type="String" >Title</Data></Cell>
                <Cell><Data ss:Type="String" >Description</Data></Cell>
            </Row>
        </Table>
        <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
          <PageSetup>
            <Layout x:Orientation="Landscape"/>
            <Header x:Margin="0.5" x:Data="{!'First line header&#10;second line header'}"/>
            <Footer x:Margin="0.5" x:Data="{!'First line footer&#10;second line footer'}"/>
            <PageMargins x:Bottom="0.5" x:Left="0.5" x:Right="0.5" x:Top="0.5"/>
          </PageSetUp>
          <Print>
            <ValidPrinterInfo/>
            <PaperSizeIndex>9</PaperSizeIndex>
            <Scale>58</Scale>
            <HorizontalResolution>600</HorizontalResolution>
            <VerticalResolution>600</VerticalResolution>
          </Print>
          <Zoom>100</Zoom>
          <DoNotDisplayGridlines/>
        </WorksheetOptions>            
      </Worksheet>
    </Workbook>
  <apex:outputText value="{!WorkbookEnd}"/>
</apex:page>
I found a reference on how to build a spreadsheet like table in VF page . Here is the link: https://developer.salesforce.com/page/Making_A_Spreadsheet_On_Force.com (https://developer.salesforce.com/page/Making_A_Spreadsheet_On_Force.com" target="_blank)
It uses ParamQuery (http://paramquery.com/grid" target="_blank) . 
My problem is when i filter some data, the paging function went wrong.
Any sugestions on how to solve this problem?

Here is the code:
<script>
        var myGridData = [];    
        var myGrid = {};
        var $myGrid;
        
        $(function(){              
            //Create Grid Table                           
            myGrid.title = "MER List";         
            myGrid.width = 900;
            myGrid.height = 600;
            myGrid.editable = false;
            myGrid.colModel = [
                {title:"Id", dataType: "string", hidden: true },
                {title:"No.", width:100, dataType:"string"},
                {title:"Title", width:150, dataType:"string"}
            ];
            
            myGrid.render = function (evt, obj) {
                var $toolbar = $("<div class='pq-grid-toolbar pq-grid-toolbar-search'></div>").appendTo($(".pq-grid-top", this));       
                
                $("<input type='button' value='Filter' class='pq-filter-btn'/>").appendTo($toolbar).click(function () {
                    pqFilter.search();
                });  
                     
                $("<input type='text' class='pq-filter-txt'/>").appendTo($toolbar).appendTo($toolbar).keyup(function (evt) {
                    if (evt.keyCode == 13) {
                        pqFilter.search();
                    }
                });     
                                
                $("<select id='pq-filter-select-column'>\
                <option value='Name'>No.</option>\
                <option value='Title__c'>Title</option>\
                </select>").appendTo($toolbar).change(function (evt){
                    pqFilter.search();
                });    
                                            
                $("<span class='pq-separator'></span>").appendTo($toolbar);
         
            };
            $myrGrid = $("#myGrid_array").pqGrid( myGrid ); 

        getMyGridData();  
    }); 

      function getMyGridData(){
            Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.MyController.queryMyList}',
                function(result){                                  
                    $(result).each(function (i) {
                        myGridData.push([result[i].Id,
                                        result[i].Name ? result[i].Name : '',
                                        result[i].Title__c ? result[i].Title__c : '']); 
                       
                    });                                       
                    $myGrid = $("#myGrid_array").pqGrid( "option", "dataModel", { data: myGridData, paging: 'local'} ); 
                }
            );
       }

    var pqFilter = {
            search: function () {
                var txt = $("input.pq-filter-txt").val().toUpperCase(),
                colIndx = $("select#pq-filter-select-column").val();

                Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.MyController.filterMyData}',
                    colIndx, txt,
                    function(result,event){
                        gridData =[];
                        $(result).each(function (i) {
                            gridData.push( [result[i].Id,
                                            result[i].Name ? result[i].Name : '',
                                            result[i].Title__c ? result[i].Title__c : '']); 
                           
                        });
                        
                        
                        $myGrid.pqGrid( "option", "dataModel", { data: gridData} );     
                        $myGrid.pqGrid("refresh");              
                    }                
                ); 
                           
            }
        }
</script>
Hi all

How to upsert csv file using command line data loder if dont have any external id
I found a reference on how to build a spreadsheet like table in VF page . Here is the link: https://developer.salesforce.com/page/Making_A_Spreadsheet_On_Force.com (https://developer.salesforce.com/page/Making_A_Spreadsheet_On_Force.com" target="_blank)
It uses ParamQuery (http://paramquery.com/grid" target="_blank) . 
My problem is when i filter some data, the paging function went wrong.
Any sugestions on how to solve this problem?

Here is the code:
<script>
        var myGridData = [];    
        var myGrid = {};
        var $myGrid;
        
        $(function(){              
            //Create Grid Table                           
            myGrid.title = "MER List";         
            myGrid.width = 900;
            myGrid.height = 600;
            myGrid.editable = false;
            myGrid.colModel = [
                {title:"Id", dataType: "string", hidden: true },
                {title:"No.", width:100, dataType:"string"},
                {title:"Title", width:150, dataType:"string"}
            ];
            
            myGrid.render = function (evt, obj) {
                var $toolbar = $("<div class='pq-grid-toolbar pq-grid-toolbar-search'></div>").appendTo($(".pq-grid-top", this));       
                
                $("<input type='button' value='Filter' class='pq-filter-btn'/>").appendTo($toolbar).click(function () {
                    pqFilter.search();
                });  
                     
                $("<input type='text' class='pq-filter-txt'/>").appendTo($toolbar).appendTo($toolbar).keyup(function (evt) {
                    if (evt.keyCode == 13) {
                        pqFilter.search();
                    }
                });     
                                
                $("<select id='pq-filter-select-column'>\
                <option value='Name'>No.</option>\
                <option value='Title__c'>Title</option>\
                </select>").appendTo($toolbar).change(function (evt){
                    pqFilter.search();
                });    
                                            
                $("<span class='pq-separator'></span>").appendTo($toolbar);
         
            };
            $myrGrid = $("#myGrid_array").pqGrid( myGrid ); 

        getMyGridData();  
    }); 

      function getMyGridData(){
            Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.MyController.queryMyList}',
                function(result){                                  
                    $(result).each(function (i) {
                        myGridData.push([result[i].Id,
                                        result[i].Name ? result[i].Name : '',
                                        result[i].Title__c ? result[i].Title__c : '']); 
                       
                    });                                       
                    $myGrid = $("#myGrid_array").pqGrid( "option", "dataModel", { data: myGridData, paging: 'local'} ); 
                }
            );
       }

    var pqFilter = {
            search: function () {
                var txt = $("input.pq-filter-txt").val().toUpperCase(),
                colIndx = $("select#pq-filter-select-column").val();

                Visualforce.remoting.Manager.invokeAction('{!$RemoteAction.MyController.filterMyData}',
                    colIndx, txt,
                    function(result,event){
                        gridData =[];
                        $(result).each(function (i) {
                            gridData.push( [result[i].Id,
                                            result[i].Name ? result[i].Name : '',
                                            result[i].Title__c ? result[i].Title__c : '']); 
                           
                        });
                        
                        
                        $myGrid.pqGrid( "option", "dataModel", { data: gridData} );     
                        $myGrid.pqGrid("refresh");              
                    }                
                ); 
                           
            }
        }
</script>