콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
7189 화면

I want to take current active model name from URL in though JS code.Is there any other way?

아바타
취소
작성자

@Nivas. Thanks it works now.

베스트 답변

You can use 'window.location.href' to get the current browser url.See my below code and you can get the current model name by splitting the string in JS.

// http://localhost:1287/web?db=mar_12#id=3&action=211&model=account.invoice&view_type=form&menu_id=88
var current_url = window.location.href;
var myArray = current_url.split("&");
var current_model = myArray[2].replace('model=',''); // model=account.invoice

Hope it will be useful for you.

아바타
취소
베스트 답변

You can get current url using location.href and can get the current model using state data 
this.state.model  --- view renderer provide the model data and its context in state parameter.
So instead of splitting the URL to get the model name you can take the benefit of widget data.

아바타
취소
관련 게시물 답글 화면 활동
0
12월 20
3897
1
7월 25
2270
2
7월 25
7747
2
7월 25
4166
2
7월 25
3944