jQuery Calx 2

Home/Project/jQuery Calx 2
jQuery Calx 2 2017-05-17T19:56:41+00:00

jQuery-calx-banner

Professional support can be obtained through
xsanisty/jquery-calx at Baikal

What’s new?

jQuery Calx version 2.0 is the successor of jQuery Calx 1.x. It offer a lot of new feature since version 1.x, let see what’s new in jQuery Calx 2.0

  • Rewrite the internal formula parser and plugin structure.
  • Ability to register new function and override default one.
  • Ability to register variable.
  • Easy graph to represent data in graphical way (additional library required)
  • Add support for string and cell range.
  • Add a lot of excel compatible function (additional library may be required).
  • Add feature to check circular reference, instead of infinite loop which make the page hang up, it’s now alerting error.
  • Add support for server-side function formula, in case you want to hide the calculation algorithm.
  • Add support to change formula, value, format easily without need to write tricky script.

To support us developing more feature on jQuery Calx 2.x, you can fork and send a pull request on the github repository https://github.com/xsanisty/jquery-calx or you can send a donation to us.

Updating from 1.x

If you are using jQuery Calx 1.x and want to update to 2.x, here is some points you need to take care of.

Replace id with data-cell for cell addressing

jQuery Calx 2.x use data-cell attribute to set the cell-address, since there are possibility of two or more same cell-address in single page

No more $ sign in formula

In jQuery Calx 1.x, we use $A1 to get the value of cell with address A1, in 2.x we completely remove the $ sign and use the cell address directly to access it’s value

152 Comments

  1. Bernd May 29, 2017 at 3:33 pm - Reply

    Dear ikhsan,
    i need to pickup a row with a named attribute rowname=’example’ something like this “….
    and to return a column from this row.
    My Idea is to create a custom definied formula and use jquery inside this formula to do this.
    What do you think, is it possible?

    • Bernd May 29, 2017 at 9:54 pm - Reply

      Ok, i tried out and it works. i just added a new function in lib and used jquery to find my row and finaly return the given text of a td in that row.

      FINDROWBYJQ: function(rowName,colName) {
      colName = colName.toUpperCase();
      rowName = rowName.toLowerCase();

      var colNames = {'B':3,'C':4,'D':5,'E':6,'F':7,'G':8,'H':9,'I':10,'J':11,'K':12};
      var col = colNames[colName];

      var result = $("#mytable tbody tr[rowname="+rowName+"]").children('td').eq(col).text();
      return result;

      }

      • bernd May 30, 2017 at 1:36 am - Reply

        Dear ikhsan,
        is there for the topic above another querstion:
        Is there a way to get the current table name (id) inside the formula-definition for use in my jquery-idea?

  2. Leonardo Cadavid May 15, 2017 at 7:16 pm - Reply

    Hello, tks for plugins, i need you one solve, i need you one conditional switch, or IF(mount1>mount2 and mount1<mount3),"price1","price2") it's possible this form ?, what ?, example ? tks very much for your colaborations.

    • ikhsan May 15, 2017 at 7:55 pm - Reply

      Hi Leonardo,

      with Calx 2, you can wrap it in AND() function

      regards,
      Ikhsan

      • Leonardo Cadavid May 15, 2017 at 8:36 pm - Reply

        Work perfect, 1.000 thanks, it´s possible join if ?, i need you join conditional or switch example

        IF(AND(X1>1000000, X12000000, X13000000, X14000000), ‘defautl’, ”)

        OR switch

        switch(X1) {
        case (X1>1000000, X12000000, X1<3000000):
        price 2
        break;
        default:
        price 3
        }

        It' s possible this in calcx ?

        http://leonetcomunicaciones.com/cotizador-online/calculadora-gastos-registro.htm

        • ikhsan May 15, 2017 at 8:47 pm - Reply

          Calx works similar with excel or any spreadsheet app if you are familiar with it.

          for multiple condition, you can use multiple IFs

          regards,
          Ikhsan

          • Leonardo Cadavid May 16, 2017 at 4:54 am

            Tks very much, work fine, you are excellent !!!

  3. Gustavo Leal March 29, 2017 at 9:01 pm - Reply

    Hi, great plugin,

    I have an issue using calx, I am using c# mvc (bundle), sometimes I get an error saying that does not recognize calx (console says – Object doesn´t support property or method ´calx´) like if the js file was not loaded by the browser. The error is on IE 11. The order which I am using to load the files are (always loads on the same order):

    1. jquery version 2.2
    2. numeral version 1.5.3
    3. moment version 2.17.1
    4. calx version 2.2.7

    My last test was changing the name of the js file trying to avoid cache or somtething like that.

    Do you have an idea how to fix this issue?

    Best Regards

  4. Rich February 20, 2017 at 11:15 pm - Reply

    Are you still supporting calx? I think this is a wonderful tool and love what you have done with it.
    I downloaded 2.2.7 from GitHub and have been playing with it for a few weeks now.
    There is a report of a problem with the “IF” formula on GitHub.
    I’ve experienced the same problem where it returns TRUE or FALSE instead of the intended result.

    Is there any chance you might still be planning to take a look at this?

    I’m hoping so, because this is such a good project.

    Best Wishes!

    • ikhsan February 20, 2017 at 11:52 pm - Reply

      Hi Rich,

      Thanks for your kind words.

      Yes, we are still supporting it, I am currently the only one in charge to maintain jQuery Calx, but I need to focus on client’s project, the other team members are still on duty too, so actually, we are out of resources, resulting in no update and issue resolve in past half year.

      Regarding to IF issue, how you write your formula? as I have no problem with this. You can take a look at http://www.vancomycin-calculator.com/ , there are a lot of IF function used on this page, and it works as intended.

      Best regards,
      Ikhsan

  5. urosz January 19, 2017 at 2:35 pm - Reply

    Hello,

    I am doing a project based on your excellent lib.
    I found a bug on version 2.2.7. If I call method ‘update’ then the cells stop working.
    If I click on a cell then no decimal values are displayed and cells randomly get NaN values.

    Would you be so kind and check this issue?

    Regards,
    Uros

  6. Gustavo Leal January 9, 2017 at 8:40 pm - Reply

    I, excellent job. Just to inform you that your code does not work with the most recent version of numeral due the “unformat” is not longer exists. Lines where unforrnat is used: 6094, 8550 and 9811.

    • ikhsan January 9, 2017 at 11:07 pm - Reply

      Thanks, I’ll check and update it

  7. JY December 20, 2016 at 5:24 am - Reply

    Hi whenever i tried to put text value rather than a numeric value in form field it gave me error, for example, formula like
    IF(A1=1,"Dance","Cook"), can calx input text?

    • JY December 20, 2016 at 5:34 am - Reply

      you know what, i just realized, i need to change ” to ‘, because the whole formula is in ” “, sorry, just disregard my question, I don’t know how to delete my question, so i replied to my own question. still thanks for the great plugin, it really helps with my form.

  8. Bernd December 12, 2016 at 4:38 pm - Reply

    Hi ikhsan,

    Are there any limits in the number of tables?

    I loadet 5 complex tables and initialized them to calx successful. Now i have to load a set of new tables in a second layer and calculate them. But when i do so, the tables in the first layer dont work any more.

    Can you please help me?

    • ikhsan December 12, 2016 at 5:44 pm - Reply

      Hi Bernd,

      There should be no limitation on how many element can be initialized by calx, as long as they are unique, and make sure the query selector did not select previously initialized calx

      • Bernd December 12, 2016 at 5:55 pm - Reply

        Hi ikhsan,
        Thanks for quick answer. Ok, i ‘ll check if selectors are unique

  9. Bernd December 12, 2016 at 4:37 pm - Reply

    Hi ikhsan,

    one Question: Are there any limits in the number of tables?

    I loadet 5 complex tables and initialized them to calx successful. Now i have to load a set of new tables in a second layer and calculate them. But when i do so, the tables in the first layer dont work any more.

    Can you please help me?

  10. Augusto August 27, 2016 at 1:25 am - Reply

    I’m trying to use the format ‘Letter”’Letter’ ‘Number’ for the data-cell property and it results in error, wich one is the range of the data-cell property??

  11. Hatalias July 8, 2016 at 1:08 am - Reply

    How to create a IF conditional, not to show true and false in result?

    IF(A1=1, myvalue true, myvalue false)

  12. Scott June 16, 2016 at 4:14 am - Reply

    Thank you for a great script.

    We have a registration form and would like to store the text value in a database after the form is submitted.

    How should we define the calculation value to do so? We want to calculate but want to store “Event Name” if chosen into the database.

    Event Name $150

    Thank you.

  13. Christopher April 28, 2016 at 11:43 pm - Reply

    Hi, I have a problem..

    Can I define my unique value for price? For example:
    <input type="radio" name="NameProduct" data-cell="A1" value="OptionNameProduct" price="10">

    Or maybe he calculate not from value of input?
    Because, I can’t submit options product to next step 🙂

    Thanks for your reply!

    Best regards,
    Christopher

  14. Andry April 12, 2016 at 4:26 pm - Reply

    Hi!
    Why is written: #ERROR! #ERROR! $ 0.00 0
    as a result of such code:

    Best regards,
    Andry

    • ikhsan April 12, 2016 at 6:44 pm - Reply

      Hi Andry,

      it seems your code is truncated, can you use the ‘crayon’ button in the comment to add your code?

      regards,
      Ikhsan

  15. Mex March 16, 2016 at 6:16 pm - Reply

    How i can operate with new attribute? Example:
    Some text

    How i can use attribute “data-next” in calculate?
    Please help 🙁

    • ikhsan March 16, 2016 at 7:13 pm - Reply

      Hi Mex,

      can you post the code sample using the “crayon” button in the comment section?

      • Mex March 16, 2016 at 7:36 pm - Reply

        Example:

        I need calculate with data-next value. It is possible? Not with default attribute value but custom attribute, for example (data-next)

        • ikhsan March 16, 2016 at 7:44 pm - Reply

          maybe you can try something like

          $(‘#form’).calx({
          data:{
          C2:{ value: $(‘[data-cell=”C2″]’).attr(‘data-next’)}
          }
          });

      • Mex March 16, 2016 at 7:42 pm - Reply

        Ikhsan,

        i have select in row and this select have two attributes (value and data-next). I need to use in the calculation of both values. But i dont know how.

        • ikhsan March 16, 2016 at 7:47 pm - Reply

          for the select box, calx will take the option value, and I think it will be ambiguous to take number from 2 different attributes

          • Pascal September 5, 2016 at 12:02 am

            Hi,

            In addition to Mex, I think i’ve the same problem. From the select box, I want the value to be placed in the database (using php) and use an separate data-price attribute to do the calculations. I’ve tryed to place the in an hidden input, that works, but Calx will not reconize the input for further calculations.

            It would be a great if you could help me! Thanks.

Leave A Comment