Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Custom visual Table using Javascript : Filter Row, Column and single Cell

Hi everybody, I am writing here hoping to find someone who can help me to find the correct way to develop a custom table visual for power BI. At this moment I am able to take data from capabilite...
  • Anonymous's avatar
    Anonymous
    7 years ago

    I solved by my self.

     

    Here is the fragment of code I have used, maybe it could help others.

    private static getSelectionIds(dataView: DataView, host: IVisualHost): ISelectionId[] {
            return dataView.table.identity.map((identity: data.SelectorsByColumn) => {
                const categoryColumn: DataViewCategoryColumn = {
                    source: dataView.table.columns[1],
                    values: null,
                    identity: [identity]
                };
    
                return host.createSelectionIdBuilder()
                    .withCategory(categoryColumn, 0)
                    .createSelectionId();
            });
            }

    Using this I am able to filter the table by row. I am talking abot versione 2.5.0. The version for 1.6 suggest by someone on internet is:

    private static getSelectionIds(dataView: DataView, host: IVisualHost): ISelectionId[] {
                return dataView.table.identity.map((identity: DataViewScopeIdentity) => {
                    const categoryColumn: DataViewCategoryColumn = {
                        source: dataView.table.columns[0],
                        values: null,
                        identity: [identity]
                    };
            
                    return host.createSelectionIdBuilder()
                        .withCategory(categoryColumn, 0)
                        .createSelectionId();
                });
            }

     

     

     

    Thank you anyway,

    Francesco Multari