angularjs - Equivalent Single Html file with export options like Datatables -


i created single html - table - export options, search, pagination using static data using datatables.

plnkr.co/edit/n3cbx8grgojtopgbxe32?p=preview 

is similar kind of example or working html available in angular-ui-grid

datatable doesn't works huge records. please kindly equivalent html file using angular ui grid..thanks in advance anything

thanks.

from looks like, able export csv , pdf. don't see evidence of excel export working. not sure offhand on print function, however, exporting pdf , printing option. can later if it's deal breaker.

the js code pretty straight forward. i've added options pdf configuration well.

the code exporting function comes verbatim ui-grid.info: 312 exporting data custom ui. converted buttons if wanted, provides external export functionality. little menu in upper right corner has these export options, i've left experimentation. setting $scope.gridoptions.enablegridmenu false turn off.

js

$scope.gridoptions = {     enablegridmenu: true,     data: 'data',     paginationpagesizes: [10],     paginationpagesize: 10,      exporterlinklabel: 'get csv here',     exporterpdfdefaultstyle: {fontsize: 9},     exporterpdftablestyle: {margin: [10, 10, 10, 10]},     exporterpdftableheaderstyle: {fontsize: 10, bold: true, italics: true, color: 'red'},     exporterpdforientation: 'portrait',     exporterpdfpagesize: 'letter',     exporterpdfmaxgridwidth: 500,      onregisterapi: function(gridapi){       $scope.gridapi = gridapi;     },    };    // verbatim: http://ui-grid.info/docs/#/tutorial/312_exporting_data_complex   $scope.export = function(){     if ($scope.export_format == 'csv') {       var myelement = angular.element(document.queryselectorall(".custom-csv-link-location"));       $scope.gridapi.exporter.csvexport( $scope.export_row_type, $scope.export_column_type, myelement );     } else if ($scope.export_format == 'pdf') {       $scope.gridapi.exporter.pdfexport( $scope.export_row_type, $scope.export_column_type );     }   }; 

html

<!-- verbatim: http://ui-grid.info/docs/#/tutorial/312_exporting_data_complex --> <label>which columns should export?</label>   <select ng-model="export_column_type"</select>     <option value='all'>all</option>     <option value='visible'>visible</option>   </select>   <label>which rows should export?</label>   <select ng-model="export_row_type"</select>     <option value='all'>all</option>     <option value='visible'>visible</option>     <option value='selected'>selected</option>   </select>   <label>what format like?</label>   <select ng-model="export_format"</select>     <option value='csv'>csv</option>     <option value='pdf'>pdf</option>   </select>   <button ng-click="export()">export</button>   <div class="custom-csv-link-location">     <label>your csv show below:</label>     <span class="ui-grid-exporter-csv-link">&nbsp</span>   </div>    <div ui-grid="gridoptions" class="grid" style="width:100%"        ui-grid-selection ui-grid-exporter ui-grid-pagination></div>   </div> 

example plunk


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -