跳至内容

欢迎!

This community is for professionals and enthusiasts of our products and services.
Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

此问题已终结
作为版主,您可以批准或拒绝该答案。
接受 拒绝

Normally we will control or retrieve data in controller for frontend. But backend is different, we need control on table

file path: administrator/components/com_ur_component/src/Table/urcomponentTable.php

example path


Then click inside, u direct search for ( $task == 'save' ), since we want to control when it save


Inside this, you can start to retrieve the data, you can retrieve 2 type of data, before user editing and after user editing.

You need create a variable with static:

static $x = 0;
<<ur code here>>

$x += 1;

This is because it will run multiple time, first time is before user editing, second time is after user editing


1. If you want retrieve data before user editing:

Then u just create a condition, when the x == 0, then read the $array and do ur code


2. If you want retrieve data after user editing:

Then u just create a condition, when the x == 1, then read the $array and do ur code


Summary:

-Create a variable to control when you want to retrieve the data.

-$array is the variable that stores the user's submitted data.

形象
丢弃

您的回复

请大家尽量给个实质性的回答。如果您想回答这个问题或发表评论,只需 使用评论工具。请记住,您可以随时修改您的答案。 - 不用重复回答同样的问题。另外,请不要忘记投票 - 它确实有助于选择最好的问题和答案!

相关帖文 回复 查看 活动
0
4月 25
55
0
2月 25
104
0
2月 25
86
0
1月 25
54
0
1月 25
55