gd-sprest-bs 10.7.7 → 10.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -122,6 +122,66 @@ var SPFxListWebPart = function (wpProps) {
122
122
  cfg = wpProps.onConfigSaving ? wpProps.onConfigSaving(cfg) : cfg;
123
123
  // Return the configuration
124
124
  return cfg;
125
+ },
126
+ // The render items event
127
+ renderItems: function (el, cfg) {
128
+ // See if a render event exists
129
+ if (wpProps.renderItems == null) {
130
+ return;
131
+ }
132
+ // Set the list
133
+ var list = (0, gd_sprest_1.Web)(cfg.WebUrl).Lists().getById(cfg.ListId);
134
+ // Ensure the list exists
135
+ if (cfg.ListId) {
136
+ // See if we are doing a caml query
137
+ if (wpProps.onListItemCAMLQuery) {
138
+ // Set the CAML query
139
+ var camlQuery = wpProps.onListItemCAMLQuery(cfg, "");
140
+ // Get the list items
141
+ list.getItemsByQuery(camlQuery).execute(
142
+ // Success
143
+ function (items) {
144
+ // Call the event
145
+ wpProps.renderItems(el, cfg, items.results);
146
+ }, function (err) {
147
+ // Call the event
148
+ wpProps.renderItems(el, cfg, []);
149
+ });
150
+ }
151
+ else {
152
+ // Set the ODATA query
153
+ var odata = wpProps.onListItemODataQuery ? wpProps.onListItemODataQuery(cfg, {}) : null;
154
+ // See if we are making an ODATA query
155
+ if (odata) {
156
+ // Get the list items
157
+ list.Items().query(odata).execute(
158
+ // Success
159
+ function (items) {
160
+ // Call the event
161
+ wpProps.renderItems(el, cfg, items.results);
162
+ },
163
+ // Error
164
+ function (err) {
165
+ // Call the event
166
+ wpProps.renderItems(el, cfg, []);
167
+ });
168
+ }
169
+ else {
170
+ // Get the list items
171
+ list.Items().execute(
172
+ // Success
173
+ function (items) {
174
+ // Call the event
175
+ wpProps.renderItems(el, cfg, items.results);
176
+ },
177
+ // Error
178
+ function (err) {
179
+ // Call the event
180
+ wpProps.renderItems(el, cfg, []);
181
+ });
182
+ }
183
+ }
184
+ }
125
185
  }
126
186
  };
127
187
  // Return the webpart