show more show less added.
Showing
1 changed file
with
42 additions
and
2 deletions
... | @@ -43,6 +43,23 @@ | ... | @@ -43,6 +43,23 @@ |
43 | 43 | ||
44 | <script> | 44 | <script> |
45 | 45 | ||
46 | function read(obj,sno){ | ||
47 | if($(obj).hasClass("less")) { | ||
48 | $(obj).removeClass("less"); | ||
49 | $(obj).html('<font style="color:#33ccff;cursor:pointer;">showmore</font>'); | ||
50 | $("#text_"+sno).css('display','none !important'); | ||
51 | $("#moreellipses_"+sno).css('display','block'); | ||
52 | } else { | ||
53 | $(obj).addClass("less"); | ||
54 | $(obj).html('<font style="color:#33ccff;cursor:pointer;">showless</font>'); | ||
55 | $("#text_"+sno).css('display','block !important'); | ||
56 | $("#moreellipses_"+sno).css('display','none'); | ||
57 | } | ||
58 | $(obj).parent().prev().toggle(); | ||
59 | $(obj).prev().toggle(); | ||
60 | return false; | ||
61 | } | ||
62 | |||
46 | var log_DataTable = ""; | 63 | var log_DataTable = ""; |
47 | log_DataTable = $('#view_logs_entries_table').DataTable({ | 64 | log_DataTable = $('#view_logs_entries_table').DataTable({ |
48 | dom: 'lBfrtip', | 65 | dom: 'lBfrtip', |
... | @@ -53,9 +70,32 @@ var log_DataTable = ""; | ... | @@ -53,9 +70,32 @@ var log_DataTable = ""; |
53 | "emptyTable": "No records found." | 70 | "emptyTable": "No records found." |
54 | }, | 71 | }, |
55 | "columns": [ | 72 | "columns": [ |
56 | { "data": "sno" }, | 73 | { "data": "sno", |
74 | "render": function( data, type, full) { | ||
75 | s_no = data; | ||
76 | return data; | ||
77 | } | ||
78 | }, | ||
57 | { "data": "name" }, | 79 | { "data": "name" }, |
58 | { "data": "log" } | 80 | { "data": "log", |
81 | "render": function( data, type, full) { | ||
82 | var showChar = 150; | ||
83 | var ellipsestext = "..... "; | ||
84 | var moretext = '<font style="color:#33ccff;cursor:pointer;">showmore</font>'; | ||
85 | var lesstext = '<font style="color:#33ccff;cursor:pointer;">showless</font>'; | ||
86 | var contentt = JSON.stringify(data); | ||
87 | var content = contentt.replace(/["]+/g, '').substring(0, contentt.length-1); | ||
88 | |||
89 | if(content.length > showChar) { | ||
90 | var c = content.substr(0, showChar); | ||
91 | var h = content.substr(showChar, content.length - showChar); | ||
92 | var html = c + '<span class="moreellipses_'+s_no+'">' + ellipsestext+ "</span><span class='morecontent'><span id='text_"+s_no+"' style='display:none;'>" + h + "</span> <a onclick='read(this,"+s_no+")'"+" class='morelink'>" + moretext + "</a></span>"; //here call the read() function | ||
93 | return html.toString(); | ||
94 | |||
95 | } | ||
96 | return data; | ||
97 | } | ||
98 | } | ||
59 | ] | 99 | ] |
60 | }); | 100 | }); |
61 | 101 | ... | ... |
-
Please register or sign in to post a comment