sorting in tablename_view.php

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
sueirna
Posts: 9
Joined: 2014-02-06 23:59

sorting in tablename_view.php

Post by sueirna » 2015-10-31 15:46

how to change sorting field in tablename_view.php.tq

User avatar
a.gneady
Site Admin
Posts: 1287
Joined: 2012-09-27 14:46
Contact:

Re: sorting in tablename_view.php

Post by a.gneady » 2015-11-01 21:04

Just click on the column title to sort ascendingly. Click again to sort descendingly.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

sueirna
Posts: 9
Joined: 2014-02-06 23:59

Re: sorting in tablename_view.php

Post by sueirna » 2015-11-02 13:53

i found this, and i've tried to change field like below, and it's working.

$x->DefaultSortField = '2';
$x->DefaultSortDirection = 'desc';

User avatar
a.gneady
Site Admin
Posts: 1287
Joined: 2012-09-27 14:46
Contact:

Re: sorting in tablename_view.php

Post by a.gneady » 2015-11-19 06:33

Aha .. Sorry, I didn't get it at first that you meant default sorting. Your code edit would work ... however, an easier method without editing code is to specify the default sorting in AppGini .. Just select the concerned table, and specify the default sort field and direction from the table options, then regenerate your application.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

User avatar
fbrano
Veteran Member
Posts: 70
Joined: 2018-03-19 10:39
Location: Slovakia
Contact:

Re: sorting in tablename_view.php

Post by fbrano » 2020-09-28 07:59

Also working via hook file tablename.php

function tablename_init(&$options, $memberInfo, &$args){

$options->DefaultSortField = '3';
$options->DefaultSortDirection = 'asc';
ver 23.15 1484

Post Reply