It's possible to send parameters to a function
in javascript function for processing in a
Jquery widget, for example records in a table
to a javascript array.
Thanks Armin
Send parameters to a javascript function ?
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 27
- Joined: Sun Jan 08, 2012 2:39 am
- Wai
- Moderator
- Posts: 165
- Joined: Wed Sep 12, 2007 9:04 am
- Location: Sandy, UK
- Contact:
-
- Ebase User
- Posts: 27
- Joined: Sun Jan 08, 2012 2:39 am
Send parameters to a javascript ...
Yes, if this is possible could you send me examples or
where to find it.
Thanks Armin
where to find it.
Thanks Armin
0 x
Armin Kessler
- Wai
- Moderator
- Posts: 165
- Joined: Wed Sep 12, 2007 9:04 am
- Location: Sandy, UK
- Contact:
You can do this by looping through your table and adding the values into a Ebase Form field (e.g: mydata), for example a comma separated list of values.
You can then use field substitution notation &&mydata to substitutte the list of values into a JS variable or array.
There is an example of this on the Ebase website with using JPlot for plotting graphs where the data is in an Ebase table.
See Resource Centre - UI Library - Graphing
The following line in the example:
would become
you therefore have to construct the string in FPL including the '['
You can then use field substitution notation &&mydata to substitutte the list of values into a JS variable or array.
There is an example of this on the Ebase website with using JPlot for plotting graphs where the data is in an Ebase table.
See Resource Centre - UI Library - Graphing
The following line in the example:
Code: Select all
s1 = [ ['Car',250],['House',600],['Bills',720],['Loans',385],['Entertainment',150],['Sundry',200] ];
Code: Select all
s1 = &&mydata
0 x
- Wai
- Moderator
- Posts: 165
- Joined: Wed Sep 12, 2007 9:04 am
- Location: Sandy, UK
- Contact:
You can also get the value of form fields using JQuery selectors such as
where mydata is the ID of your field control. See HTML Element Properties.
Code: Select all
$('#mydata').val()
Last edited by Wai on Mon Mar 04, 2013 2:15 pm, edited 1 time in total.
0 x
-
- Ebase User
- Posts: 27
- Joined: Sun Jan 08, 2012 2:39 am
Wai:
Thank you very much for your attention, and I hope you the best for this year 2013.
Thanks Armin
Thank you very much for your attention, and I hope you the best for this year 2013.
I don't understand quote , could you ilustrate this with an example or where to find it.You can do this by looping through your table and adding the values into a Ebase Form field (e.g: mydata), for example a comma separated list of values.
Thanks Armin
0 x
Armin Kessler
- Wai
- Moderator
- Posts: 165
- Joined: Wed Sep 12, 2007 9:04 am
- Location: Sandy, UK
- Contact:
For example, the JPLOT JQuery graph plugin requires the following to render a pie chart:
[label,value],[label,value],[label,value]...etc
You can build this in FPL (or javascript in 4.4) with values in your table.
For example to plot sales percentages of products we'll pass something like this below, where the label is a table column (mydata-product) and value is a table column (mydata-sales):
['Twix', 19.63],['Snickers', 7.47],['Paprika', 6.12],['Others', 66.78]
In our script we can build this as a string into an Ebase field (data):
Hope that helps.
[label,value],[label,value],[label,value]...etc
You can build this in FPL (or javascript in 4.4) with values in your table.
For example to plot sales percentages of products we'll pass something like this below, where the label is a table column (mydata-product) and value is a table column (mydata-sales):
['Twix', 19.63],['Snickers', 7.47],['Paprika', 6.12],['Others', 66.78]
In our script we can build this as a string into an Ebase field (data):
Code: Select all
set data = null
loop at table mydata
set data = '[\'' + mydata-product + '\',' + mydata-sales + '],';
endloop
// Removing the trailing comma:
set data = substring(data,1,length(data) - 1);
0 x
Who is online
Users browsing this forum: No registered users and 11 guests