Author Topic: Test using the demo program (Batch editing with remote paging)  (Read 912 times)

Richard

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 41
  • Richard
    • View Profile
Hi
I am trying to make a program that reads and modifies data in the database and saves it in the database.
Auto save (https://paramquery.com/pro/demos/editing_remote_page) among the demo programs is similar, so
I saved the source file displayed on the demo screen on my computer and ran it with a web browser.
No data is displayed on the screen.
I would like to receive a complete example file.
« Last Edit: March 04, 2022, 06:58:16 am by Yunhwan Ro »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Test using the demo program (Batch editing with remote paging)
« Reply #1 on: March 04, 2022, 09:06:00 am »
The javascript displayed under the example has been copied and pasted to the index.js file in stackblitz. Also the urls has been changed from relative to absolute.  :)

And id of grid has been updated to grid_editing in index.html

https://stackblitz.com/edit/paramquery-demo-import-xlsx-6phwhz
« Last Edit: March 04, 2022, 09:07:34 am by paramvir »

Richard

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 41
  • Richard
    • View Profile
Re: Test using the demo program (Batch editing with remote paging)
« Reply #2 on: March 05, 2022, 05:50:55 am »
Copy each demo program at the link address you gave me (https://stackblitz.com/edit/paramquery-demo-import-xlsx-6phwhz?file=index.js)
After creating a file and saving it on my computer, edit the url in the index.js file
I searched using a web browser (http://127.0.0.1/index.html).
As a result, the data stored in the DB is not displayed and only the message 'No rows to display' is displayed.

As a result of inquiring the server program (http://127.0.0.1/products.php) with a web browser,
the DB data was accurately displayed and searched as shown below.

DB connection OK!!
{"data":[{"ProductID":1,"ProductName":"AA","QuantityPerUnit":1,"UnitPrice":2,"UnitsInStock":3,"Discontinued":true},
{"ProductID":2,"ProductName":"BB","QuantityPerUnit":11,"UnitPrice":22,"UnitsInStock":33,"Discontinued":false}]}

Even if you search after editing the url in the index.js file (add https://paramquery.com/pro/),
only the message 'No rows to display' is displayed.

All files used for the test are attached.

Please help what the problem is.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Test using the demo program (Batch editing with remote paging)
« Reply #3 on: March 07, 2022, 10:31:03 am »
When you open http://127.0.0.1/products.php in your web browser, the correct output should be:

Code: [Select]
{"data":[{"ProductID":1,"ProductName":"AA","QuantityPerUnit":1,"UnitPrice":2,"UnitsInStock":3,"Discontinued":true},
{"ProductID":2,"ProductName":"BB","QuantityPerUnit":11,"UnitPrice":22,"UnitsInStock":33,"Discontinued":false}]}

DB connection OK!! line should not appear in the output.


PS: It's convenient to use web developer console of browser to resolve the issues related to interaction of pqgrid or any js control with remote scripts.
« Last Edit: March 07, 2022, 11:23:24 am by paramvir »

Richard

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 41
  • Richard
    • View Profile
Re: Test using the demo program (Batch editing with remote paging)
« Reply #4 on: March 08, 2022, 04:31:15 am »
As you mentioned, after modifying the program,
I connected to http://127.0.0.1/index.html and the DB data was displayed on the screen.
Thank you very much.

However, after modifying some of the data displayed on the screen and clicking the 'Save Changes' button,
When Reload(F5) is performed, the data is the same as before modification.

Even when I tried Reload (F5) after pressing the 'Delete' button and clicking the 'Save Changes' button,
The data is not deleted and it is the same as before.

Please help me with what's wrong.
« Last Edit: March 08, 2022, 04:50:37 am by Yunhwan Ro »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Test using the demo program (Batch editing with remote paging)
« Reply #5 on: March 08, 2022, 11:41:26 am »
Please correct your code in saveChanges function in index.js file.

Code: [Select]
data: {
       //JSON.stringify not required for PHP
       list: gridChanges
},

Richard

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 41
  • Richard
    • View Profile
Re: Test using the demo program (Batch editing with remote paging)
« Reply #6 on: March 10, 2022, 02:40:34 pm »
Your help solved the problem.
Thank you so much :)