Problem with JOIN
Problem with JOIN
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
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
This discussion has been closed.
Replies
Allan
Victor.
Allan
In the mean time, what is the JSON return from the server that you are seeing in Firebug / Inspector?
Allan
->join(
Join::inst( 'competitive_provs', 'object' )
->join( 'id_competitor', 'id_competitor' )
->field(
Field::inst( 'name' )
)
)
the PHP returns empty
Thank you !!
> 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