How to keep ag grid filter after selecting all filtered?

  Kiến thức lập trình

I have an ag grid table that I am filtering, and upon a button click it is set to select all the rows that are currently filtered using selectAllFiltered(), and after clicking the button the filtered rows are

js = JsCode("""
 function(event) {
    const api = event.api; 
     window.addEventListener('clear.rows', (e) => {
        api.deselectAll();
     });
     window.addEventListener('select.rows', (e) => {
        api.selectAllFiltered();

     });    
 }
 """)

if st.sidebar.button('Select All Filtered Rows'):
    selectJs = '''<script>
     ((e) => {
        const iframe = window.parent.document.querySelectorAll('[title="st_aggrid.agGrid"]')[0] || null;
        if(!iframe) return;
        iframe.contentWindow.dispatchEvent( new Event('select.rows'));
     })()
    </script>
    '''
    components.html(selectJs)

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT