button element not showing in list

p38

Active Member
Hi,

I had assumed that a button element would show in the list, but it seems not so.

How can one show the buttom element, and allow the javascript actions to be active at the same time?

Paul
 
This is going to be awkward, as the context for rendering the button in the list view won't be the same as when in the form view, resulting no doubt in javascript errors if the button appeared and was pressed in the list view.

I've added a js list plugin to git which should allow you to add a button, in the same way as you would add a php list plugin - which runs js supplied in a file or written in one of the plugins options

-Rob
 
here is a suggestion, could one not add a button icon to the button element options, and render this icon in the list?

When clicked, the normal actions apply?

Paul
 
I don't see how that would work. The js you run on a form has a very good chance of not working in a list. Did you take a look at the js list plugin i added - I think that is a better way to deal with user activated javascript interaction within lists
 
Ok, have got to this and will do for my need thanks it can work.

One error can you fix please : if no javascript file is selected, and one uses internal JS code, it looks like the system still searches for a non-existant file

JFile: :read: Unable to open file: /usr/www/users/indooatxdt/plugins/fabrik_list/js/scripts/-1

Also I noticed that it also display's a popup statusmessage after the script has run. How can I disable this?



Paul
 
hi Paul

the -1 script include thing should be fixed.
For the status message, if you leave that empty now, no alert will be shown.

--Rob
 
Thanks, it looks ok now.

In a form, I use
var name = Fabrik.blocks['form_3'].formElements.get('im_slideshow___display');
to get the element value.

How can I do the same in the js list plugin to get an element value of the slected record.

Looks like the formelement does not work on list level.

Paul
 
Hi
In the latest git version of the plugin your scripts should have access to a variable 'row' which is an object keyed on the row id and containing the row's data

Code:
var = row.1.im_slideshow_display_raw;
 
thanks,

just to be sure, is "row.1" just your naming convention for the current selected row? the .1 does not make sense, unless it is an ID.

In other words, running
var = row.1.im_slideshow_display_raw;
in the button script will always return the row element data (im_slideshow_display_raw) of the corresponding current button that was called (pressed)?

Paul
 
sorry for not being clear.

First the object is

Code:
rows
(not row)

then say in your list you select rows with primary key values 1, 4, and 5, and run the js plugin

An abbreviated example of your rows object will then be:

Code:
rows = {
  1: {im_slideshow_display: 'value', im_slideshow_display_raw: 'value'},
  4: {im_slideshow_display: 'value', im_slideshow_display_raw: 'value'},
  5: {im_slideshow_display: 'value', im_slideshow_display_raw: 'value'},
}

so to access the slideshow_display value in row 4 you do:

Code:
var v = row.4.im_slideshow_display_raw;

to access row 5's value:

Code:
var v = row.5.im_slideshow_display_raw;
 
thanks very much,

how would I find what row fired the JS action?

For this to be useable, one needs to know which row caused the JS to action, so you can pull the relevant row data via your row obnject to work with it.

eg:

Code:
var selectedrow = rows.selectedrow;
 
var v = row.selectedrow.im_slideshow_display_raw;


paul
 
hi Paul

the -1 script include thing should be fixed.
For the status message, if you leave that empty now, no alert will be shown.

--Rob

Rob,

updated from Git, and now the script does not even run, not even your "Waka Waka" test script. I cleared caches, tried other browsers to no avail.

Please don't take 2 days to reply, as this is holding me up so I need to get my site implemented.

Also I see
Object.keys(row);
is only compatible with IE9 and up, is this correct? If so, how would we support IE8?
 
No errors, just does nothing. It was working fine prior to the latest update.

How can I see where the problem is?

the more critical problem is this
updated from Git, and now the script does not even run, not even your "Waka Waka" test script. I cleared caches, tried other browsers to no avail.

The latest updated does not even allow any JS scripts to run, not even your test script.

I need this asap please.

Paul
 
Can you provide the URL to the page, as I said it works here so I'm stuck without knowing which page it is that you have set this up on.
Catch me on the live chat @ fabrikar.com so we can resolve this
 
I cannot get the element values from the selected row.
var mykeys = Object.keys(rows); returns the correct rowid, eg: 160,
but var v = rows.160.im_slideshow_display_raw; will not return anything, says undefined?
How do I get the element values of the rowID?
 
As Rob said, can you give us the exact URL to the page? We nee to see it running on your site, and debug it there.

I'm around for the new few hours, if you want to catch me on live chat.

-- hugh
 
Hi Rob, we are almost there, just need clarity on your JS structure defs to get the element values out. I have exhausted all possibilities, so am sure it is just syntax that needs to be clarified.

Paul
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top