How idSRC works
How idSRC works
Sunilgoel
Posts: 48Questions: 19Answers: 0
Hi Support,
I have slno unique key auto increment mysql table field.
I want to update row using editor using slno but do not want to display slno in table . can i use idSRC for this purpose or any other way to do this.
Regards.
Sunil
This discussion has been closed.
Answers
Hi Sunil,
Are you using the Editor PHP or .NET libraries? If so, the manual describes how you can use a custom primary key column name.
Allan
Hi Allan,
I am using Editor PHP . I have done everything written in manual and using custom primary key but Editor allows me to edit one column at a time and after changed Editor moves changed row to end of table.
Regards.
Sunil
Can you show me your PHP code and also give me a link to the page showing the issue so I can help to debug it please.
Regards,
Allan
Hi Allan, this is my code
Regards.
Sunil
Hi Allan,
I can show you issue via team viewer if you prefer .
Regards.
Sunil
Sure. That would be covered by the support options.
Regarding the code. First of all remove:
That is only needed if you aren't using the provided PHP (or .NET) libraries.
Secondly, if your primary key is called
slno
why have you set the third parameter in theEditor:inst()
constructor to beid
?Allan
slno is not my primary key , primary key is id , slno is sequence no for our internal use only.
after remove idSRC , Editor stopped editing .
Regards.
Sunil
Hi Allan,
I have purchased basic support option as suggested. Now you can see via team viewer.
Regards.
Sunil
Hi Allan,
I want to add below code in user_targets_update.php
if you remember , you have removed fetch data and told me that you can directly use update to fetch data .
Please suggest how can i add above code in update php.
Actually while fetch data of particular account_id if no record exists then dataTables insert records in table before fetch data send for Edit.
Regards.
Sunil
HI Sunil,
Under what circumstances do you want to use the code above? Only when editing, creating? Server-side events are perfect for that sort of thing.
Thanks,
Allan
Hi Allan,
when DataTables goes for fetchdata to populate . If No records found in database then insert from crm_targets table where account_id='000'.
Regards.
Sunil
I think I understand - this you basically want to have a template and if there is no data for the current user it should copy in new settings. Is that correct?
If so, what we could do is something like this:
Basically all that is doing it checking if there is a
action
parameter in the POST parameters. If there isn't then DataTables is doing a data fetch request, and that's when you would run your code.Insert that immediately before the
Editor::inst( ... );
code, that that should be all that is needed!Regards,
Allan
Hi Allan,
I am able to insert record from template but i have to make seprate database connection to do this , can i use $db .
Regards.
Sunil
Hi Sunil,
Yes, absolutely you could use the
$db
parameter. That is a reference to theDatabase
class that is defined in the Editor PHP libraries - it is fully documented here.For example you might use:
We need to use the
sql
method rather than one of the abstraction methods for the insert since you are combining it with a select. You could do a separate select then insert, but this is morefii.Allan