Problem with JOIN

Problem with JOIN

vicfebovicfebo Posts: 20Questions: 0Answers: 0
edited December 2012 in General
Hello,

I have problems to show the results of query join.
This is my JS configuration:

oTableOpers = $('#competitive_prices').dataTable( {
"sDom": "Tfrtip",
"sAjaxSource": "DataTablesEditor/php/xxxx.php",
"aoColumns": [

{
"mData": "competitive_provs.name"
},
{
"mData": "id_terminal"
},
{
"mData": "id_marca_movical"
},
{
"mData": "id_operador"
},
{
"mData": "descripcion"
},
{
"mData": "url",
"mRender": function (val, type, row) {

var sReturn = "" + val + "";
return sReturn;
}
},
{
"mData": "price"
},
{
"mData": "activo"
},
{
"mData": "date_obtained"
}
],
"oTableTools": {
"sRowSelect": "multi",
"aButtons": [
{ "sExtends": "editor_create", "editor": editor },
{ "sExtends": "editor_edit", "editor": editor },
{ "sExtends": "editor_remove", "editor": editor }
]
}
}
);



This is the PHP configuration:


// DataTables PHP library
include( "lib/DataTables.php" );

// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Join,
DataTables\Editor\Validate;


// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'competitive_price', 'id_comp' )
->fields(
Field::inst( 'id_comp' ),
Field::inst( 'id_competitor' ),
Field::inst( 'id_terminal' ),
Field::inst( 'id_marca_movical' ),
Field::inst( 'id_operador' ),
Field::inst( 'descripcion' ),
Field::inst( 'url' ),
Field::inst( 'search_tag' ),
Field::inst( 'offset' ),
Field::inst( 'extra_info' ),
Field::inst( 'notes' ),
Field::inst( 'price' ),
Field::inst( 'activo' ),
Field::inst( 'date_obtained' )
)
->join(
Join::inst( 'competitive_provs', 'object' )
->join( 'id_competitor', 'id_competitor' )
->field(
Field::inst( 'name' )
)
)
->process( $_POST )
->json();


The table result shows:

No data available in table



Both tables (competitive_price and competitive_provs) have the same name of primary key (id_competitor)



And the javascript console shows this error:

Error: TypeError: v is null
Archivo de origen: /jquery.dataTables.min.js



Any suggestion please?
Línea: 135

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    The `Join` class is only available in the Editor that can be downloaded with a licensed copy of Editor - it is not included in the trial. That might well be the issue, but if you could post a link to the page that would be very useful to confirm that is the issue.

    Allan
  • vicfebovicfebo Posts: 20Questions: 0Answers: 0
    Thank you for your rapid response. The DataTableEditor code is of payment, is not the trial code.

    Victor.
  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    Can you confirm which account you purchased Editor from please? I don't have a record of your purchase at the moment, just the trial version.

    Allan
  • vicfebovicfebo Posts: 20Questions: 0Answers: 0
    Yes of course, with the user: "hugomeana"
  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    Okay - has the license been transferred to yourself? If so, I can transfer the license to your own account so it shows up in my admin panel. I'll drop hugomeana an e-mail to confirm as well.

    In the mean time, what is the JSON return from the server that you are seeing in Firebug / Inspector?

    Allan
  • vicfebovicfebo Posts: 20Questions: 0Answers: 0
    The response is empty. The PHP does not return anything, according to Firebug :(
  • vicfebovicfebo Posts: 20Questions: 0Answers: 0
    Sorry, "hugomeana" has not transferred the license, but he is a companion of work.
  • vicfebovicfebo Posts: 20Questions: 0Answers: 0
    In the moment I add this:

    ->join(
    Join::inst( 'competitive_provs', 'object' )
    ->join( 'id_competitor', 'id_competitor' )
    ->field(
    Field::inst( 'name' )
    )
    )

    the PHP returns empty
  • vicfebovicfebo Posts: 20Questions: 0Answers: 0
    Solved !!! I update de Join.php and it works !!

    Thank you !!
  • allanallan Posts: 63,531Questions: 1Answers: 10,474 Site admin
    Excellent.

    > Sorry, "hugomeana" has not transferred the license, but he is a companion of work.

    The license is for a single developer. If you are both using it (or others as well?) then additional licenses are needed since Editor licensing is done on a per developer basis, rather than a per site basis.

    Please feel free to ping me an e-mail or PM if you want to discuss your licensing requirements for Editor further.

    Regards,
    Allan
This discussion has been closed.