I would like to know the best way to proceed. I explain the problem:
I created a module (B), this module is related to another module (A), so in module A I have a subpanel that goes into module B.
Now, I would like to click on an element of the subpanel (row 1 - column 1; row 1 - column 3; row 1 - column 4), to open the detail of that element. My question, is it necessary to create a form for each item I click (the data is the same, but grouped differently - for example, if I click on the date, I will have the detail of that particular day; if I click on the name I will have the detail of that particular name).
Or do I have to create a new query, modifying the code in some way?
Hope to get an answer, thanks in advance
@fab
You should make some forms for each view. Additionally you should do custom button to change object: âSugarWidgetSubPanelDetailViewLinkâ
Example code for modules/< module name >/metadata/subpanels/< subpanel name >.php
Ok, so the way to proceed is to create a module for each element I click, I thought that being the same data anyway, but grouped differently, I could use other, I saw it a waste to create a module
hi p.konetskiy,
Iâve been hitting my head for a while and Iâm only now answering. Two questions:
ok target_record
ok target_module
but I do not understand
'<target variable of object SugarWidgetSubPanelDetailViewLink>' => '<value of variable>'
what should be put in place of target variable of object SugarWidgetSubPanelDetailViewLink?
another thing:
through the targets I activated the link to my module, the problem is that that link in the subpanel does not correspond to a unique record in the target panel (for example the record that contains the date 25/08, in the target module there are more records with that date and therefore, apparently, cannot identify it).
How can I solve?
For different links to look at:
file include/generic/SugarWidgets/SugarWidgetSubPanelDetailViewLink.php
You should write your custom function âdisplayListâ in file:
custom/include/generic/SugarWidgets/SugarWidgetSubPanelDetailViewLink.php
This function will be call for all links. You analyse your combination filed and value ( â< target variable of object SugarWidgetSubPanelDetailViewLink >â => â< value of variable >â ) and make custom link or call parent function.
For different view to look at:
function âgetMetaDataFileâ in file modules/Users/views/view.detail.php
You should write custom function âgetMetaDataFileâ for your module and copy it to file: custom/modules/<your_module_name>/views/view.detail.php
I entered in SugarWidgetSubPanelDetailViewLink a query to the table referenced by the subpanel click, this way I get the ID that record points to and replaced $ record = $ id, now, when I click on that element, the connection string becomes ⌠record = $ id and thatâs fine, but if, going to the subpanel, I go to the next pages of the subpanel, I lose the links to the elements, reloading the whole page, the links reappear
I made some small changes to your code because it didnât work for me.
Once I got the record id through my query, I changed $add_params = '&detailviewform ='. $Layout_def['target_field'];
in $ add_params = '&record ='. $id;
and I havenât used the function getMetaDataFile()
now it seems to be fine, at least at first sensation, I have to finish testing it.
Thank you very much p.konetskiy, you have been of great help.
Be careful because the parameter ârecordâ already present in http link. Look at ajaxlink in the file: custom/include/generic/SugarWidgets/SugarWidgetSubPanelDetailViewLink.php
The code in file (custom/modules/Contacts/views/view.detail.php) make to open different forms. The ajaxlink was modified for it.
Yes, I saw that record is already present, but apparently if I insert &record=âŚ&record=⌠in the connection string, it doesnât create any problems and is very useful if you want to insert a search with a double parameter.
Honestly, I donât understand either getMetaDataFile() (why use it?), Nor where does it get the âcityâ value you set in custom/modules/Contacts/metadata/subpanels/ForAccounts.php: 'target_field' => 'city'
because in SugarWidgetSubPanelDetailViewLink I donât see anything
This is your choice ârecord = ⌠record = âŚâ. I paid attention to this only.
The function âgetMetaDataFileâ select file for detailview. There are the custom âdetailcityviewdefs.phpâ or the standard âdetailviewdefs.phpâ in my example.
The parametr âtarget_fieldâ => âcityâ is example only.
I pay attention that I made the file custom/include/generic/SugarWidgets/SugarWidgetSubPanelDetailViewLink.php in custom directory. I copied to the file standard class and changed it as I wrote before.