Edit not working with join

Edit not working with join

mboscombosco Posts: 3Questions: 2Answers: 0

Data source: Ajax
Processing mode: Server-side
Draws: 1
Columns: 9
Rows - total: 4
Rows - after search: 4
Display start: 0
Display length: 100

Error message:

Unknown column demotest1.id in field list

Description of problem:
When trying to edit on joins(between tables 'demotest' and 'demotest1'), the _Select() function in Query.JS(1109) throws an error because the _BuildJoin() method that is calls returns null. So the statement turns out to be:

"SELECT demotest.id as 'demotest.id', demotest1.id as 'demotest1.id' FROM demotest WHERE demotest.id = @where_0 AND demotest1.id = @where_1"

The _BuildJoin() relies on the _join variable (Query.JS,795) but the variable is never intialized, seemingly because Join()(Query.JS,239) is never called beforehand to assign values. I'd like to know if it is supposed to be called later? Is it possible that something is wrong with my leftJoin("demotest1","demotest1.id","=","demotest.id") function call?

Answers

  • allanallan Posts: 61,726Questions: 1Answers: 10,110 Site admin

    Can you show me your server-side code in full please? I don't immediately see anything wrong there.

    Thanks,
    Allan

  • mboscombosco Posts: 3Questions: 2Answers: 0

    @allan thanks for getting back. :) I was able to resolve the matter. It was an incorrect parameter to the function call of Editor().LeftJoin(). I accidentally included both the tables' primary keys in the pkeylist to Editor. Changing that to only the pkey of the main table resolved the issue.

This discussion has been closed.