Get cell value from Table/List

teoyh

Member
Please refer to the attachment.
I have a table or List , where the first column is the sapno, I wish to return the column(Global View) value of the first row where sapno = oa30003108.
To know the rowid I can use the following code
var rowid = td.findClassUp('fabrik_row').id.replace(this.table.id + '_row_', '');

I then try to replace the above with the following it did not work.
var globalview = td.findClassUp('fabrik_row').TLP_ADMIN___global_view.replace(this.table.id + '_row_', '');

Can someone help me with the javascript, many thanks.
 

Attachments

  • InLineEdit.jpg
    InLineEdit.jpg
    40.2 KB · Views: 402
I've recently added some js code to our list.js file, so if you are using today's github you can do:

JavaScript:
// Set 11 to the required row id, must be a string value
var row = Fabrik.blocks.list_1_com_fabrik_1.getRow("11");
 
var label = row.TLP_ADMIN___global_view;
var value = row.TLP_ADMIN___global_view_raw;
 
Hi rob thanks for your reply , I added the following to my javascript file ;

var rowid = td.findClassUp('fabrik_row').id.replace(this.table.id + '_row_', '');
var row = Fabrik.blocks.list_1_com_fabrik_1.getRow(rowid);
var label = row.TLP_ADMIN___global_view;
var value = row.TLP_ADMIN___global_view_raw;

but on the page I get an error which say 'Fabrik' is undefined.

Can the above be use for Fabrik 2.x as I remember only in Fabrik 3.x , table is call list.

Await your reply. Many thanks
 
Ah, I think Rob didn't notice this was a 2.1 question. So no, that won't work.

Can you point me at your page? I'm not entirely clear where you are putting your code, or what triggers it.

-- hugh
 
Sorry its in an intranet environment so can't point u to the page. I am adding it to the javascript file for the inline edit table plug.
 
the js is only for 3.x - sorry I had not seen this was in the 2.x forum.

You can only get the cell text (not the underlying value that the database stores) , this js would work

JavaScript:
var tableid = 9;
var rowid = 7;
$('table_' + tableid + '_row_' + rowid).getElements('td[class*=TLP_ADMIN___global_view]')[0].get('text')
 
What if the column is a yes/no element it does not have a text, how to extract from table view. Many thanks
 
Rob...I try to apply the the code below in latest Fabrik version does not seem to work

$('table_' + tableid + '_row_' + rowid).getElements('td[class*=TLP_ADMIN___global_view]')[0].get('text')

Is there an updated code for above.

Many thanks
 
Moved.

So ... did you try the method Rob originally posted for 3.x, up there ^^ somewhere, as opposed to the correct 2.x method he then posted?

-- hugh
 
Awesome , oh how could i miss out the earlier post.
This work -> Fabrik.blocks.list_Xx_com_fabrik_Xx.getRow(rowid) Xx is your List ID

An example
var rowid = this.getRowId(td);
var rowref = Fabrik.blocks.list_10_com_fabrik_10.getRow(rowid);

To get the value I then call rowref.xxx_xxxx___xxx; Where xxx_xxxx___xxx is the element name
var empno = rowref.account_management___sapno_raw;
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top