Upload plugin not working correctly
Upload plugin not working correctly
Every time I edit a row to upload a file to a row, it ends up changing the date to null or start of SQL date. I can not figure out why it is passing date even though I have told it not to.
I created a custom button for file uploads when editing a row because I am using inline edit.
This is the query it runs that makes the date change:
"UPDATE charges
SET Date
= :Date, Paid
= :Paid, Modified
= :Modified, User
= :User, documentId
= :documentId WHERE charges
.id
= :where_0"
This question has an accepted answers - jump to answer
Answers
I actually just discovered it is doing this on columns I have a setFormatter applied to. How would I only make it run if the value is set? I tried simply saying if($val != null) but that doesn't seem to work.
I think the main issue is actually in my custom upload button function. I got it to stop making date null but now it is not returning the correct row. What would be the best way to fix this?
When the editor_upload gets created per row, in the callback, I assigned that ID to editor_upload which is why this gets its id.
Hi,
Could you clarify what you mean by "in the callback, I assigned that ID to editor_upload which is why this gets its id"? I don't quite understand what the use case is I'm afraid.
It looks like you have two different Editor instances being used at the same time, is that correct?
edit( values )
doesn't look quite right to me - theedit()
method will accept a row identifier - it does not expect an object of values as is being given above.Allan
Yes I have different instances being used. The child row needed to be editable also. It basically just repeats the same information for columns that may or may not be hidden by the user. I work for some crazy people. The use case is that at the end of each row is a drop down with a 'duplicate, delete, upload' action and I only wanted the upload action to display the upload field not the rest of the row. Here is my code... let me know if I could provide anything else. Thanks!
Sorry, I should have posted my whole code. It's just lengthy so I didn't.
Forgive any stupidity in the code, I know it's not the best.
http://pastie.org/10282091
Edit: I forgot to mention. I've been playing around with the function and just trying ways to work around it. I know it's not currently the best but it's 80% working now.
Here is a screenshot of the table, if it helps. I couldn't show the whole thing for reason beyond my control but it should show the idea.
http://i.imgur.com/BusVPyN.png
So you mentioning the it accepts a row identifier, it appears I finally got it working. Can't believe it took me so long to figure this out. Can you please tell me if there would be a better way to do this?
The only issue I seem to be having now is, when I click upload, perform the upload, and click save. When I later go back and click on upload, it shows 2 'x's at the top right?
http://i.imgur.com/eYVtRJI.png
The only change I think that could be made is to use
edit( this )
. However I've made an assumption there - is.editor_upload
thetr
element for the row? If not, then how does the above work without having duplicate ids in the HTML.Odd! If you do it a third time, does it show 3? Are you using the Bootstrap modal for Editor (it doesn't look like the default lightbox)?
Regards,
Allan
Well wouldn't this then refer to the a href?
<a href="" class="editor_upload" id="upload_'+data.DT_RowId">Upload</a>
It gets called as a render for column and I added upload before the id so it would be different than row_id.
I know I have the editor bootstrap css included. Is there a separate one for just modals?
No it never shows 3 if I click it a third, fourth, etc.