List Manager Forum

Conditionally show the "details" button

Usuario Scotolati 2015-06-09 19:22:24

Hi everyone,
on my project I have lists with records that can have a (html) "description" field filled or not.
I need to show the "details" button only on rows where the description exists.
I'm trying to edit javascript so that it checks when the field is empty before adding the "imgdetail" icon (listmanager.js, line 1058), but this has turned out to be quite difficult as all data is loaded and restructured dynamically, using lots of functions and very obscure design patterns.
Honestly, I despise the huge amount of JS this component uses, it's excessive, heavy and hard to customise!

Any hints on where to get data from the row while adding the buttons?

Usuario Scotolati 2015-06-09 19:47:13

Ahh, done I was close!
I've added some lines in listmanager.js:405

var hasDetail = false;
for(var h=0; h var html_value = this.getRow(i).getData(header.id).getValue();
if ( html_value !== "")
hasDetail = true;
}

and a check at line 576:
if (this.acl.isDetail() && hasDetail) {"

PS: apparently I can't insert code here, the line I needed was this:
this.getRow(i).getData(header.id).getValue();

Edited by Scotolati - 09.06.2015 19:50

Moonsoft support 2015-06-10 08:41:16

Hi,

Great!, your solution is right, thanks for sharing. The extension follows joomla mvc pattern, and for the frontend it does such a huge amount of dynamic functions that js is required, with a lot of custom classes and even code patterns (observers, etc...), so we'd prefer to say is complex.

Regards,

...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!
...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!