Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds method for customising primary key and entry identifiers for social features #308

Merged
merged 6 commits into from
Jan 31, 2020

Conversation

tonytlwu
Copy link
Contributor

@tonytlwu tonytlwu commented Jan 30, 2020

Ref. https://github.com/Fliplet/fliplet-studio/issues/5704

To define a custom primary key:

Fliplet.Hooks.on('flListDataBeforeGetData', function (options) {
  options.config.dataPrimaryKey = 'Session ID';
});

To create a custom primary key based on various data:

Fliplet.Hooks.on('flListDataBeforeGetData', function (options) {
  options.config.dataPrimaryKey = function (data) {
    return _.get(data, 'record.data.Title') + '-' + _.get(data, 'record.data.Date');
  };
});

Also follows #299 to adjust some agenda layout spacing.

@squallstar
Copy link
Contributor

@tonytlwu why does the primary key attribute needs the data prefix? Could there be a primaryKey applying to a different entity?

@tonytlwu
Copy link
Contributor Author

@squallstar I don't have any scenario for it. However, the config object describes the configuration for the LFD instance, which is feature rich. Not that I'd know why yet, but primary keys could possibly apply to comments, users etc.

@tonytlwu tonytlwu merged commit bd7be92 into master Jan 31, 2020
@tonytlwu tonytlwu deleted the feat/custom-identifier branch January 31, 2020 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants