Variable values in the data option

Variable values in the data option

shida05shida05 Posts: 2Questions: 1Answers: 0
edited November 2023 in Free community support

I am wondering why, in the code below, elements d.tot and d.user look like they are being set to constants (17 and dshirey). But, if I sign on with a different user ID, both of these values change (e.g. 6 and cathye). Does anyone know how that is possible?

oTable = $('#table_001').dataTable({
                    "processing": true,
                    "serverSide": true,
                    "lengthMenu": [10, 25, 50, 100], // records pulldown
                    "iDisplayLength": 100, // # records to initially display
                    "ajax": {
                        "url": "rest/WEB014L2",
                        "data": function(d) { // pass additional pameters
                            d.tot = "17"; //data set total - ALWAYS INCLUDE
                            d.user = "dshirey"; //user id - ALWAYS INCLUDE
                            d.key = "000001297671941"; //data set key - ALWAYS INCLUDE
                            d.cols = "10"; // TOTAL <td> tags per <tr> tag

                            d.whse = "330";
                            d.cust = "";
                            d.locn = "";
                            d.orig = "VELOCITY";
                

Edited by Kevin: Syntax highlighting. Details on how to highlight code using markdown can be found in this guide

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,083Questions: 26Answers: 4,908

    Where are you seeing this change? What are the debugging steps used to see this change?

    There is nothing obvious in your code that suggests the tot and user values are set to 6 and cathye. Can you post a link to your page or a test case replicating the issue so we can help debug?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • shida05shida05 Posts: 2Questions: 1Answers: 0

    I am not doing a debug. I am just looking at the PHP code. I accidentally signed on with a secondary ID and saw that the values had changed. I don't think I can post a link. This is a client's program and that would violate their security rules. I just wondered if there was a way for the values to change when they look like they are hard coded.

  • kthorngrenkthorngren Posts: 21,083Questions: 26Answers: 4,908
    edited November 2023 Answer ✓

    I am just looking at the PHP code. I accidentally signed on with a secondary ID and saw that the values had changed.

    Sorry, I'm not clear where you are seeing the different values. Are you saying the code snippet above had different values when you logged in with the secondary ID?

    I just wondered if there was a way for the values to change when they look like they are hard coded.

    The specific code above won't change the values. There are events like preXhr where the data parameters sent can be set or changed. Maybe your solution is using this event.

    Kevin

  • adityaradityar Posts: 3Questions: 1Answers: 0

    thanks

Sign In or Register to comment.