How to programmatically "fix" delete? How to "unselect" programmatically.

How to programmatically "fix" delete? How to "unselect" programmatically.

belldrbelldr Posts: 12Questions: 4Answers: 0

I have two questions:
1. Is there an easier way to do all this,
2. How can I "unselect" a row programmatically.

My example is editor example #1.

Here are details.

When you start the example, the Edit and Delete button are disabled, because nothing is selected. After you select and delete a record (row - I am only doing single rows), nothing is selected, but the Edit and Delete buttons are still enabled. I want them to be disabled.

I have another button, that appears next to Delete, that I want to follow this same pattern (disabled if nothing selected). Right now, I can enable and disable the buttons using processing kicked off by editor events associated with delete and also select and statesave events, but this seems complicated (?)

I seem to have "selected" shading left over - this is probably my issue, but, what is the best way to unselect a row with id = #123, programmatically? Ideally, I want the shading gone, and the buttons disabled, and any knowledge in datatables about the record being selected to be erased. Will that "best way" work whether or not the record is in front of me, or scrolled off the screen, or even on another page? I have tried removing the "selected" class, but I end up with rows that have some of the columns shaded correctly, but others not shaded correctly. (I am using alternate shading of rows, and special shading on the column that is sorted)

Is there an easier way to do all this?

Thanks for any comments.

Replies

  • allanallan Posts: 61,438Questions: 1Answers: 10,049 Site admin

    Hi,

    Thanks for letting me know about this issue! This is a bug in the Select extension. I've just committed a fix and the nightly version is up to date with this change.

    I'll probably release an update to Select at the end of the week, which will include this change.

    Regards,
    Allan

  • belldrbelldr Posts: 12Questions: 4Answers: 0

    Wow! Thank you. I will download, and check it out.

  • belldrbelldr Posts: 12Questions: 4Answers: 0

    Allan, I don't think it worked. No change.

    I downloaded dataTables.buttons.min.js, dataTables.select.min.js, and jquery.dataTables.min and installed in the correct locations. But after I delete, the buttons are still enabled. I cleared cache, and even tried a different browser, but still no change. Is there something else I should do? This is my first time working with hotfix. Is there an update to Editor I need? My order of installation, which has been generally working, is ,

    <script type="text/javascript" src="/includes/js/jquery.inputmask.bundle.min.js"></script>, 
    
    <script type="text/javascript" src="/DataTables-1.10.8/media/js/jquery.dataTables.min.js"></script>, 
    <script type="text/javascript" src="/DataTables-1.10.8/extensions/Buttons/js/dataTables.buttons.min.js"></script>, 
    <script type="text/javascript" src="/DataTables-1.10.8/extensions/Select/js/dataTables.select.min.js"></script>, 
    
    <script language="javascript"   src="/includes/js/bpopup.js"></script>, 
    
    
    <script language="javascript"   src="/includes/js/jquery-ui.js"></script>
    
    
    <script type="text/javascript" src="/includes/js/jquery.timepicker.js"></script>, 
    <script type="text/javascript" src="/DataTables-1.10.8/extensions/Editor/js/dataTables.editor.min.js"></script>
    
  • allanallan Posts: 61,438Questions: 1Answers: 10,049 Site admin
    edited August 2015

    In the dataTables.select.min.js file could you do a search for the string select.dt.DT deselect.dt.DT. If you have the fixed version it should be prefixed by draw.dt.DT (this is the diff for the fix).

    No change for Editor should be required - just the change in Select.

    Edit Also possible that you might need to clear your local cache.

    Thanks,
    Allan

  • belldrbelldr Posts: 12Questions: 4Answers: 0

    Allan, Just saw your message. I checked, and the change is there. Didn't seem to fix things.

    Just so I don't let a long time go by like this in the future, when might I possibly see messages from you? This seems to be marked 10:56 AM. Is that "my time" East Coast US? If my time, what time would that be where you are? What hours do you most often respond to questions? (Don't worry, I am not expecting anything like a guaranteed response...) Don

  • allanallan Posts: 61,438Questions: 1Answers: 10,049 Site admin

    This seems to be marked 10:56 AM. Is that "my time" East Coast US?

    To be honest, I'm not sure! I suspect it is "server time" which is BST, but it might be that the forum software does something clever with the Javascript...

    What hours do you most often respond to questions?

    UK working hours. I typically do a pass first thing in the morning and last thing at night.

    I'm not sure why the fix wouldn't work for you to be honest - it seems to be working well here. Are you including another version of Select somewhere perhaps? Can you give me a link to the page so I can check it out?

    Allan

  • belldrbelldr Posts: 12Questions: 4Answers: 0

    Have been diligently refining my event-driven code, to handle disabling the buttons, and also disabling the related buttons, and keeping everything in sync with server-side.

    I have it "good enough to use", but it really isn't right, with occasional duplicate rows shaded, etc.

    When you release an official upgrade, with editor example working, I will give it a shot.

    Is there a method to programmatically deselect a row?

    Thanks. Don

  • allanallan Posts: 61,438Questions: 1Answers: 10,049 Site admin

    Is there a method to programmatically deselect a row?

    rows().deselect() and row().deselect().

    Allan

This discussion has been closed.