|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | +<head> |
| 4 | + <title>$$(Title_append-rows-on-demand)</title> |
| 5 | + <meta charset="utf-8" /> |
| 6 | + <!-- Ignite UI Required Combined CSS Files --> |
| 7 | + <link href="%%ignite-ui%%/css/themes/infragistics/infragistics.theme.css" rel="stylesheet" /> |
| 8 | + <link href="%%ignite-ui%%/css/structure/infragistics.css" rel="stylesheet" /> |
| 9 | + |
| 10 | + <script src="%%modernizr%%"></script> |
| 11 | + <script src="%%jquery%%"></script> |
| 12 | + <script src="%%jquery-ui%%"></script> |
| 13 | + |
| 14 | + <!-- Ignite UI Required Combined JavaScript Files --> |
| 15 | + <script src="%%ignite-ui%%/js/infragistics.core.js"></script> |
| 16 | + <script src="%%ignite-ui%%/js/infragistics.lob.js"></script> |
| 17 | + |
| 18 | + <script src="%%jsrender%%" type="text/javascript"></script> |
| 19 | + |
| 20 | + <style type="text/css"> |
| 21 | + .tweet-user { |
| 22 | + font-size: 14px; |
| 23 | + font-family: Arial, sans-serif; |
| 24 | + font-weight: bold; |
| 25 | + float: left; |
| 26 | + } |
| 27 | + |
| 28 | + .tweet-text { |
| 29 | + font-size: 14px; |
| 30 | + font-family: Arial, sans-serif; |
| 31 | + } |
| 32 | + |
| 33 | + .tweet-screen-name { |
| 34 | + font-size: 12px; |
| 35 | + font-family: Arial, sans-serif; |
| 36 | + color: #999; |
| 37 | + margin-left: 10px; |
| 38 | + float: left; |
| 39 | + } |
| 40 | + |
| 41 | + .tweet { |
| 42 | + float: none; |
| 43 | + padding-left: 50px; |
| 44 | + } |
| 45 | + |
| 46 | + .tweet p { |
| 47 | + margin: 5px; |
| 48 | + } |
| 49 | + |
| 50 | + .tweet-date { |
| 51 | + float: right; |
| 52 | + font-size: 12px; |
| 53 | + font-family: Arial, sans-serif; |
| 54 | + color: #999; |
| 55 | + } |
| 56 | + </style> |
| 57 | + |
| 58 | +</head> |
| 59 | +<body> |
| 60 | + <h3>$$(AppendRowsOnDemand_Auto_Caption)</h3> |
| 61 | + <table id="autoAppendRowsOnDemand"></table> |
| 62 | + <br> |
| 63 | + |
| 64 | + <h3>$$(AppendRowsOnDemand_Button_Caption)</h3> |
| 65 | + <table id="buttonAppendRowsOnDemand"></table> |
| 66 | + <br> |
| 67 | +<script> |
| 68 | + |
| 69 | + $(function () { |
| 70 | + //jsRender helper function which formats the string date |
| 71 | + $.views.helpers({ |
| 72 | + formatDate: function (val) { |
| 73 | + var date = new Date(val); |
| 74 | + if (!isNaN(date) && ($.type(date) === "date")) { |
| 75 | + return $.ig.formatter(date, "date", "dateTime"); |
| 76 | + } |
| 77 | + return val; |
| 78 | + } |
| 79 | + }); |
| 80 | + |
| 81 | + //Hide the button after all data is loaded. |
| 82 | + $(document).delegate("#buttonAppendRowsOnDemand", "iggridrendered", function (evt, ui) { |
| 83 | + $("#buttonAppendRowsOnDemand_loadMoreButton").click(function () { |
| 84 | + var totalRecCount = $("#buttonAppendRowsOnDemand").data("igGrid").dataSource.totalRecordsCount(); |
| 85 | + var currentRecCount = $("#buttonAppendRowsOnDemand").data("igGrid").dataSource.totalLocalRecordsCount(); |
| 86 | + var chunkSize = $("#buttonAppendRowsOnDemand").igGridAppendRowsOnDemand("option", "chunkSize"); |
| 87 | + if (totalRecCount <= currentRecCount + chunkSize) { |
| 88 | + $("#buttonAppendRowsOnDemand_loadMoreButton").hide(); |
| 89 | + } |
| 90 | + }); |
| 91 | + }); |
| 92 | + |
| 93 | + $('#autoAppendRowsOnDemand').igGrid({ |
| 94 | + dataSource: 'http://igniteui.com/api/tweets', |
| 95 | + responseDataKey: 'Records', |
| 96 | + autoGenerateColumns: false, |
| 97 | + enableUTCDates: true, |
| 98 | + columns: [ |
| 99 | + { |
| 100 | + unbound: true, |
| 101 | + key: 'Tweets', |
| 102 | + headerText: 'Infragistics Tweets', |
| 103 | + template: '<div style=\'float:left\'><img src=\'../../images/ig_twitter_logo.png\' ></img></div><div class=\'tweet\'><p style=\'height:20px\'><span class=\'tweet-user\'>{{>User.Name}}</span><span class=\'tweet-screen-name\'>@{{>ScreenName}}</span><span class=\'tweet-date\'>{{>#view.hlp(\'formatDate\')(CreatedAt)}}</span></p><p class=\'tweet-text\'>{{>Text}}</p></div>' |
| 104 | + } |
| 105 | + ], |
| 106 | + features: [ |
| 107 | + { |
| 108 | + recordCountKey: 'TotalRecordsCount', |
| 109 | + chunkIndexUrlKey: 'page', |
| 110 | + chunkSizeUrlKey: 'pageSize', |
| 111 | + name: 'AppendRowsOnDemand', |
| 112 | + loadTrigger: 'auto', |
| 113 | + type: 'remote' |
| 114 | + } |
| 115 | + ], |
| 116 | + width: '100%', |
| 117 | + height: '300px', |
| 118 | + templatingEngine: 'jsrender' |
| 119 | + }); |
| 120 | + |
| 121 | + $('#buttonAppendRowsOnDemand').igGrid({ |
| 122 | + dataSource: 'http://igniteui.com/api/tweets', |
| 123 | + responseDataKey: 'Records', |
| 124 | + autoGenerateColumns: false, |
| 125 | + enableUTCDates: true, |
| 126 | + columns: [ |
| 127 | + { |
| 128 | + unbound: true, |
| 129 | + key: 'Tweets', |
| 130 | + headerText: 'Infragistics Tweets', |
| 131 | + template: '<div style=\'float:left\'><img src=\'../../images/ig_twitter_logo.png\' ></img></div><div class=\'tweet\'><p style=\'height:20px\'><span class=\'tweet-user\'>{{>User.Name}}</span><span class=\'tweet-screen-name\'>@{{>ScreenName}}</span><span class=\'tweet-date\'>{{>#view.hlp(\'formatDate\')(CreatedAt)}}</span></p><p class=\'tweet-text\'>{{>Text}}</p></div>' |
| 132 | + } |
| 133 | + ], |
| 134 | + features: [ |
| 135 | + { |
| 136 | + recordCountKey: 'TotalRecordsCount', |
| 137 | + chunkIndexUrlKey: 'page', |
| 138 | + chunkSizeUrlKey: 'pageSize', |
| 139 | + name: 'AppendRowsOnDemand', |
| 140 | + loadTrigger: 'button', |
| 141 | + type: 'remote' |
| 142 | + } |
| 143 | + ], |
| 144 | + width: '100%', |
| 145 | + height: '300px', |
| 146 | + templatingEngine: 'jsrender' |
| 147 | + }); |
| 148 | + }); |
| 149 | +</script> |
| 150 | + |
| 151 | +</body> |
| 152 | +</html> |
0 commit comments