If you are still in contact with your ex wife and talk to her on occasion it is ok to spend time with her during her time of grief. If you have children you should be there for them as well.
Spending time with someone that you once cared about enough to marry during a period of intense bereavement is far more than the okay thing to do, it is by far the right thing to do.