I need to convert to negative when adding an amount.
// Row Rendered event
function Row_Rendered() {
if (CurrentUserLevel() == 3) {
$(this).fields("pa_importe").value();
}
}
Thanks.
I need to convert to negative when adding an amount.
// Row Rendered event
function Row_Rendered() {
if (CurrentUserLevel() == 3) {
$(this).fields("pa_importe").value();
}
}
Thanks.
You cannot mix jQuery/Javascript code in Server Events section just like that.
You should use "Client-side Events" for such case. Please refer to the demo project, click on "orderdetails" table, go to "Fieds" setup -> "Edit Tag" pane, click on "Quantity" field, and then click on "Client side events" property to see the related Javascript code. Adjust it to your needs, for example by multiple the value by -1.
I can convert it to negative, but I need to condition only for certain CurrentUser Level, there is a way to use:
Other idea? Thanks.
if (CurrentUserLevel() == 2) {
Just in case someone else needs it:
{ // keys = event types, values = handler functions
"change": function(e) {
// Your code
var Dif= $(this).fields("ph_importe").value();
var res= (Dif*-1);
var res_1= res.toFixed(2)
$(this).fields("ph_importe").value(res_1);
}
}
This code is client-side.
eayvl wrote:
{ // keys = event types, values = handler functions
"change": function(e) {
// Your code
var Dif= $(this).fields("ph_importe").value();
var res= (Dif*-1);
var res_1= res.toFixed(2)
$(this).fields("ph_importe").value(res_1);
}
CurrentUserLevel() is server-side variable.
So what you need to do is to pass this variable from server-side to client-side.
Here is how:
Page_Load()
ew_SetClientVar("myVar", CurrentUserLevel());
Then within your client-side code call this variable this way:
if (ewVar.myVar == 2) {bla..bla..bla..}