Skip to Content

Welcome!

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.

This question has been flagged
As a moderator, you can either validate or reject this answer.
Accept Reject

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.

Avatar
Discard

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Related Posts Replies Views Activity
0
Apr 25
13
0
Feb 25
52
0
Feb 25
42
0
Jan 25
42
0
Jan 25
38