please resolve below queries.

please resolve below queries.

krishanu_debnathkrishanu_debnath Posts: 17Questions: 1Answers: 0

Need answer of below questions
1) Want to print "100.00" instead of 100 in Amount field under data table. Means want to add extra '.00' with data. (Line No 51)
2) want to change alignment from left to right. only for Balance filed data. into data table. (Line No 50)
3) Want to print 'code' value to messageTop which is return from ajax result . currently it print '0'. (Line No 43)
4) When ajax return null, I want to show 'No Data Fount' but currently its loading, nothing is showing, Need to refresh data for next action.

data = [{"id":"1","Code":"123","balance":"100","amount":"1000"},{"id":"2","Code":"123","balance":"200","amount":"3000"}, {"id":"3","Code":"123","balance":"400","amount":"6000"}]

1. function validateform(){
2.                 var code = '0';
3.                     $('#rpt_table').DataTable( {
4.                         dom: 'Bfrtip',
5.                         fixedHeader: true,
6.                         colReorder: true,
7.                         responsive: true,
8.                         sPaginationType: "full_numbers",
9.                         bLengthChange: true,
10.                         order: [[ 0, 'asc' ]],
11.                         aLengthMenu: [[5, 10, 15, 20, -1], [5, 10, 15, 20, , "All"]],
12.                         working properly
13.                         iDisplayLength: 5,
14.                         aaSorting: [1, 'asc'],
15.                         bProcessing: true,
16.                         initComplete: function( settings, json ) {
17.                             $('div.loading').remove();
18.                         },
19.                 ajax: function (data, callback, settings) {
20.                 $.ajax({
21.                     url: "url",
22.                                 type: "POST",
23.                                 cache: false,
24.                                 data: jsonData,
25.                                 contentType: "application/json;",
26.                                 dataType:"json"
27.                 }).done(function(response) {
28.                                 code = response[0].Code;     ** //want to print this value to messageTop**
29.                                 callback({    
30.                         draw: response.draw,
31.                         data: response,
32.                         recordsTotal: response
33.                     });
34.                 }).fail(function(err){
35.                     console.error('error...', err);
36.                 });
37.             },
38.             buttons: [
39.                             {
40.                                 extend: 'excelHtml5',
41.                                 title: 'My PDF', 
42.                                 messageTop:'Code'+code,         **//question 3**
43.                                 titleAttr: 'Excel'
44.                             }
45.                         ],
46.                 columns: [
47.                             {data: 'id'},
48.                             {data: 'code'},
49.                             {data: 'balance'},   ** //question 2**
50.                             {data: 'amount'}    ** //question 1**  
51.                         ]
52.                     });
53.                 
54.             }

Replies

Sign In or Register to comment.