Hi All!
Could anyone share tips please, how to display at table view one extra column with record owner.
Like on the picture below:
Thanks!
Display record owner at table view
-
- Veteran Member
- Posts: 35
- Joined: 2016-02-16 22:31
Re: Display record owner at table view
Hi,
one possibilty is that you create an additional field (lets call it "owner") to your table (I use "jobsplanning" as the table and id as the pk) in this post.
Make this field read-only in AppGini.
Next you generate your project and after that you edit the jobsplanning_view.php file.
Search for the part
// Fields that can be displayed in the table view
$x->QueryFieldsTV = array(
should be around line 23.
You will see the at the end of the array your new field owner.
Replace the code with the following:
You can also replace the code in the other arrays:
$x->QueryFieldsCSV = array(
$x->QueryFieldsFilters = array(
$x->QueryFieldsQS = array(
This should to the trick.
Please note that you will no see the information in the detail view of the record.
one possibilty is that you create an additional field (lets call it "owner") to your table (I use "jobsplanning" as the table and id as the pk) in this post.
Make this field read-only in AppGini.
Next you generate your project and after that you edit the jobsplanning_view.php file.
Search for the part
// Fields that can be displayed in the table view
$x->QueryFieldsTV = array(
should be around line 23.
You will see the at the end of the array your new field owner.
Replace the code with the following:
Code: Select all
"IF( CHAR_LENGTH((SELECT memberid from membership_userrecords where pkvalue=jobsplanning.id and tablename='jobsplanning')), CONCAT_WS('', (SELECT memberid from membership_userrecords where pkvalue=jobsplanning.id and tablename='jobsplanning')), '') /* owner */" => "owner"
$x->QueryFieldsCSV = array(
$x->QueryFieldsFilters = array(
$x->QueryFieldsQS = array(
This should to the trick.
Please note that you will no see the information in the detail view of the record.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
-
- Veteran Member
- Posts: 35
- Joined: 2016-02-16 22:31
Re: Display record owner at table view
Hi Pböttcher
Thank you so much!!!
Yes, that work perfect! And do the trick.
One more question:
Would be possible some how convert this trick as hook, to save manually change every single time after generate project at AppGini?
Thnaks
Thank you so much!!!
Yes, that work perfect! And do the trick.
One more question:
Would be possible some how convert this trick as hook, to save manually change every single time after generate project at AppGini?
Thnaks
Re: Display record owner at table view
Yes, this should work as well:
via the hooks/jobsplanning.php.
via the hooks/jobsplanning.php.
Code: Select all
function jobsplanning_init(&$options, $memberInfo, &$args){
$mystr="IF( CHAR_LENGTH((SELECT memberid from membership_userrecords where pkvalue=jobsplanning.id and tablename='jobsplanning')), CONCAT_WS('', (SELECT memberid from membership_userrecords where pkvalue=jobsplanning.id and tablename='jobsplanning')), '') /* owner */" => "owner";
$options->{"QueryFieldsTV"}[$mystr]=$options->{"QueryFieldsTV"}["`jobsplanning`.`owner`"];
$options->{"QueryFieldsCSV"}[$mystr]=$options->{"QueryFieldsTV"}["`jobsplanning`.`owner`"];
$options->{"QueryFieldsFilters"}[$mystr]=$options->{"QueryFieldsTV"}["`jobsplanning`.`owner`"];
$options->{"QueryFieldsQS"}[$mystr]=$options->{"QueryFieldsTV"}["`jobsplanning`.`owner`"];
unset($options->{"QueryFieldsTV"}["`jobsplanning`.`owner`"]);
unset($options->{"QueryFieldsCSV"}["`jobsplanning`.`owner`"]);
unset($options->{"QueryFieldsFilters"}["`jobsplanning`.`owner`"]);
unset($options->{"QueryFieldsQS"}["`jobsplanning`.`owner`"]);
}
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.
-
- Veteran Member
- Posts: 35
- Joined: 2016-02-16 22:31
Re: Display record owner at table view
Hi Pböttcher
Thank you so much for your help last time!!!
Now using the new version AppGini 5.80 we can add same information into app using "Calculated fields" MySQL query, I'm right?
Could I ask please for sample of SQL query using same Idea as in original post.
Many thanks!
Thank you so much for your help last time!!!
Now using the new version AppGini 5.80 we can add same information into app using "Calculated fields" MySQL query, I'm right?
Could I ask please for sample of SQL query using same Idea as in original post.
Many thanks!