Skip to content

Commit

Permalink
Added the row limit property for views.
Browse files Browse the repository at this point in the history
  • Loading branch information
gunjandatta committed Dec 14, 2023
1 parent d10fda7 commit ffab3c9
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions @types/helper/spCfg.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ export interface ISPCfgViewInfo {
/** The JSLink property. */
JSLink?: string;

/** The row limit property. */
RowLimit?: number;

/** The view fields. */
ViewFields?: Array<string>;

Expand Down
3 changes: 3 additions & 0 deletions dist/gd-sprest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3861,6 +3861,9 @@ declare module 'gd-sprest/helper/spCfg' {
/** The JSLink property. */
JSLink?: string;

/** The row limit property. */
RowLimit?: number;

/** The view fields. */
ViewFields?: Array<string>;

Expand Down
2 changes: 1 addition & 1 deletion dist/gd-sprest.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/gd-sprest.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gd-sprest",
"version": "7.7.8",
"version": "7.7.9",
"description": "An easy way to develop against the SharePoint REST API.",
"author": "Gunjan Datta <me@dattabase.com> (https://gunjandatta.github.io)",
"license": "MIT",
Expand Down
4 changes: 3 additions & 1 deletion src/helper/spCfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ export const SPConfig = (cfg: ISPConfigProps, webUrl?: string): ISPConfig => {
// Add the view
views.add({
Title: cfg.ViewName,
RowLimit: cfg.RowLimit,
ViewQuery: cfg.ViewQuery
}).execute((view) => {
// Ensure it exists
Expand Down Expand Up @@ -1129,7 +1130,7 @@ export const SPConfig = (cfg: ISPConfigProps, webUrl?: string): ISPConfig => {
}

// See if we are updating the view properties
if (typeof (cfg.Default) === "boolean" || cfg.JSLink || cfg.ViewQuery) {
if (typeof (cfg.Default) === "boolean" || cfg.JSLink || cfg.RowLimit > 0 || cfg.ViewQuery) {
let props = {};

// Log
Expand All @@ -1138,6 +1139,7 @@ export const SPConfig = (cfg: ISPConfigProps, webUrl?: string): ISPConfig => {
// Set the properties
typeof (cfg.Default) === "boolean" ? props["DefaultView"] = cfg.Default : null;
cfg.JSLink ? props["JSLink"] = cfg.JSLink : null;
cfg.RowLimit > 0 ? props["RowLimit"] = cfg.RowLimit : null;
cfg.ViewQuery ? props["ViewQuery"] = cfg.ViewQuery : null;

// Update the view
Expand Down
2 changes: 1 addition & 1 deletion src/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { IREST } from "../@types";
* SharePoint REST Library
*/
export const $REST: IREST = {
__ver: 7.78,
__ver: 7.79,
AppContext: (siteUrl: string) => { return Lib.Site.getAppContext(siteUrl); },
Apps: Lib.Apps,
ContextInfo: Lib.ContextInfo,
Expand Down

0 comments on commit ffab3c9

Please sign in to comment.