add grid selected function