Forum Stats

  • 3,874,239 Users
  • 2,266,700 Discussions
  • 7,911,777 Comments

Discussions

Integrate Datatables api on APEX

Gonçalo
Gonçalo Member Posts: 14 Red Ribbon

Hi,

I'm performing an integration with the Datatables API, all work fine but now i get a problem when i want to submit the page through a button. I get this error:

--> ERR-1002 Unable to find item ID for item "example_length" in application "110"

Basically i have a select list with 2 values, that dependent of the value the table changes. What is curious is that with button don t work but if i change the value of the select list and click on the "refresh page" of the browser all work fine.

Someone know what is happening?

The example is the id of the table.

Thank you.

Apex Version: 20.2.0.00.20

Database Version: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.3.0.0.0

Tagged:

Answers

  • InoL
    InoL Member Posts: 10,199 Blue Diamond

    I'm performing an integration with the Datatables API

    What is the "Datatables API"? Is there something with "example_length" in that code that you are supposed to exchange with your actual value?

  • Gonçalo
    Gonçalo Member Posts: 14 Red Ribbon


    I notice this on the css :

    .dataTables_length{float:left}.dataTables_wrapper .dataTables_length select{border:1px solid #aaa;border-radius:3px;padding:5px;background-color:transparent;padding:4px}

    In Javascript to initialize i use this function:

    $(document).ready(function() {

        $('#example').DataTable();

    } );

    The example is the id of my table.

    The JS i use is this, but don't found anything suspicious :

    Thank you

  • Gonçalo
    Gonçalo Member Posts: 14 Red Ribbon

    I found what happened, if i add the value false to the paging all work:

    `$(document).ready(function() {

    $('#example').DataTable({

    paging: false});

    } );`

    This is the id of the page selector of the table, where you can define the number of the rows per page.

    Its a bug of apex. Anyone ever experience this?

    Thank you

  • InoL
    InoL Member Posts: 10,199 Blue Diamond
    edited Feb 9, 2021 8:53PM

    Its a bug of apex.

    DataTables is not part of Apex, so how can it be an Apex bug?

    Can you use an Interactive Report instead of DataTables? IR is standard Apex.

    Sylvain Martel
  • Sylvain Martel
    Sylvain Martel Member Posts: 856 Silver Trophy

    Hello Gonçalo,

    People following this forum know me as the guy that ask: "What are you trying to achieve? What is your business requirements?"

    Since I don't know Datatables API I can't tell if it's a stupid question, but I'm tempted to ask you anyway. Can't you do whatever you are trying to do directly on the Oracle database or using a web service?

    I need to get educated.

  • Gonçalo
    Gonçalo Member Posts: 14 Red Ribbon

    Because we already tryed and populated them with dynamic sql, the columns can vary dependent on report and the query. The client don't liked because the fields are treated as strings and he can't sort numerics with precision so he pointed us this api.

    I'm not criticizing the apex, on the contrary, for me i used only apex. I just mention a bug because he identify this id as a page item id.

  • Sylvain Martel
    Sylvain Martel Member Posts: 856 Silver Trophy

    So if I understand properly, you are trying to create a unique APEX page that generates a report (probably Classic) having a different SQL statements (dynamic) and different generated columns according to some parameters. Ok.

    The problem with this solution is that it might not age so well. Lots of JS! In my opinion, you should go back to your dynamic SQL, maybe add collections, and try to make that to work, if you absolutely need this flexible reporting engine.

    I will be following your progress to see how it turns out.

    Good luck!

  • Gonçalo
    Gonçalo Member Posts: 14 Red Ribbon

    We already tryed with an interactive report that with a funtion returns a query and because we need to pass items on the function that didn t work well because always "appear" that "no data found" and other problem was change the name of the columns dinnamically. In classic report works but we can t use it because client don t liked.

    Then we came accross with apex collections and we found this:


    The problem is that don t fully cover all the client needs, like aggregations, sorting the numbers, so he sugested the Datatables and we implemented building all the collections and develop the dynamic sql and all work fine, the only problem was that id that the apex interpretates as a page item, don t know why.

    And basically is that, if i discover something i will post here, maybe can help someone in the future.

    Sylvain Martel