collaps or expand Swimlanes

I use the Kanban control to assign tasks to teammembers. The name of the teammember is the keyfield in the KanbanSwimlaneSettings.

When the page is rendered for the fist time, I would like to collapse all swimlanes except the swimlane of the current user. Is this


3 Replies

VJ Vinitha Jeyakumar Syncfusion Team November 28, 2022 09:38 AM UTC

Hi Franz,

Your requirement to collapse all the swimlanes except the swimlane of the current user can be achieved by using the JsInterop in Blazor. Please check the code and sample below,

Code snippet:
    public string currentUser { get; set; }
    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        currentUser = "Nancy Davloio";
        if (firstRender)
        {
            // here need to passs your current user's keyField
            await jsRuntime.InvokeAsync<object>("CalledJSFunctionWithParameter", currentUser);  
        }
    }
Layout.cshtml:
function CalledJSFunctionWithParameter(name) {  
            for (var i = 0; i < document.querySelectorAll('.e-swimlane-header .e-item-count').length; i++) {
                  if(document.querySelectorAll('.e-swimlane-row')[i].getAttribute("data-key") != name){            
                     document.querySelectorAll('.e-swimlane-header')[i].querySelector('.e-icons').click();
                }      
            }
        }  


If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.

Regards,
Vinitha


FB Franz Bichlmaier November 29, 2022 02:58 PM UTC

Thank you. 


It works as expected.



VJ Vinitha Jeyakumar Syncfusion Team November 30, 2022 04:46 AM UTC

Hi Franz,


We are glad to assist you.

Regards,
Vinitha

Loader.
Up arrow icon