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

Configurable parameters #192

Open
robbielove opened this issue Feb 8, 2022 · 0 comments
Open

Configurable parameters #192

robbielove opened this issue Feb 8, 2022 · 0 comments

Comments

@robbielove
Copy link

robbielove commented Feb 8, 2022

I would like it if the params 'direction', 'sort' were hardcoded as a default config setting rather than hardcoded in general.

Personally, I prefer to use 'order' as 'direction' and it causes the need for both parameters in the URL because I just use 'order' and force it to populate direction so that sortable works.

This would also allow them to be translated too.

eg. something like this (i just got a random bit of code)

        $sortParamName = config('columnsortable.sort_param_name', 'sort');
        $directionParamName = config('columnsortable.direction_param_name', 'direction');

        if (is_string($array)) {
            return [$sortParamName => $array, $directionParamName => $defaultDirection];
        }

        return (key($array) === 0) ? [$sortParamName => $array[0], $directionParamName => $defaultDirection] : [
            $sortParamName      => key($array),
            $directionParamName => reset($array),
        ];
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

No branches or pull requests

1 participant