@shelkovnikovdv

@shelkovnikovdv

Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • in reply to: Row filter not showing after server side data load #101956

    Hi Gourav.
    After downloading data from the server filters are rendered normally.
    But then something is called and makes all cells filter row empty.
    This code saves the day

    
    let smartgrid = ...
    virtualDataSource: function (resultCallbackFunction, details) {
       ...
       function refreshFilterPanel() {
          for (var i = 0; i < smartgrid.columns.length; i++) {
              smartgrid.columns[i]._filterEditorInitialized = false;
          };
          smartgrid._renderFrozenRows();
       }
       loadFromServer().then( (data) => {
          resultCallbackFunction({
             dataSource: data.items,
             virtualDataSourceLength: data.totalRecords
          });
          refreshFilterPanel();
          ....
        })
    }
    

    Best regards, Dmitry

    Hello, friends!
    In addition
    1) I see in the debugger how DataAdapter notifies about data changes in Smart-Grid through DataAdapter._notify
    2) I don’t see how Smart-Grid notifies that it has changed the data in DataAdapter
    Is there something I don’t understand or are there no such notifications?
    Best regards, Dmitry.

    Hello, friends. Made such an example with code.
    1. We have a part in the Vuex storage where we store user data (store\modules\users.js )

    const state = {
        all: []
    };
    const mutations = {
        SET_ALL(state, payload) {
            state.all = payload.data;
        }
    }
    const actions = {
        setItems(context, data) {
            return context.commit('SET_ALL', { data });
        }
    }
    

    2. We have a Vue list component where we only display and edit usernames. How the data source acts $store.state.users.all

    export default {
        name: 'user-list',
        props: {
           value: {
               type: Array,
               default: () => $store.state.users.all
           }
      }
    }
    

    3. We have a Vue component with smart grid where you can view all information about users, add, change and delete.
    For Smart.DataAdapter me also use $store.state.users.all

    export default {
        name: 'user-grid',
        methods {
    	getDataSource(data) {
                return new Smart.DataAdapter({
                    dataSource: $store.state.users.all,
                    keyDataField: 'id',
                    dataFields: [
                       'id: number',
                       'name: string',
                       'nick: string',
                    ]
                });
    	}
       }
    }
    

    4. Now if something is changed in ‘user-list’ it will be reflected in ‘$store.state.users.all’, but ‘user-grid’ will not be automatically updated
    Accordingly. If now if something is changed in ‘user-grid’ it will find not automatic reflection in ‘user-list’ and ‘$store.state.users.all’ in the Vuex store will not be updated either
    This is our problem. But before rushing into battle, I would like to know if we are reinventing the wheel.

Viewing 3 posts - 1 through 3 (of 3 total)