how to load page b using expander in page a? - atk4

as you know, we can use this code in index and it works truely...
it loads the page_userreferals...
$g->addColumn('expander','userreferals',"Users List");
but when I use it in other pages, an error occurs...
Exception_PathFinder, code: 0
Additional information:
file: desk\Page\userreferals.php
type: page
attempted_locations:
0: C:/wamp/www/test/page/desk/userreferals.php
...
the problem is that the agile tookit search for the requested page in subdirectory. how can we change that?

try:
$grid->columns['userreferals']['page'] = $this->api->url('b');

Or
class page_main extends Page {
function page_bla() {
...
$g->addColumn('expander','userreferals',"Users List");
....
}
function page_bla_userreferals() {
}
}

Related

Show Hide Menus MVC jQuery

Can anyone help me out discovering the correct way to show/hide menu items according to AbpUserRoles?
I am simply adding two menu items that should only be available to role=admin.
My code causes the Admin menu to show when it should not:
Code:
var adminMenu = context.Menu.GetAdministration();
adminMenu.Items.Add(new ApplicationMenuItem("Admin.Sites", "Sites", "/Sites"));
adminMenu.Items.Add(new ApplicationMenuItem("Admin.UserSites", "User Sites", "/UserSites"));
ok, so the way I ended up doing this was by getting hold of the CurrentUser as follows:
public class YourProjectMenuContributor : IMenuContributor
{
private async Task ConfigureMainMenuAsync(MenuConfigurationContext context)
{
if (context.GetHttpContext().User.IsInRole("admin"))
{
//....configure as required...
}
}
}

ExtJS loading panels repetition

In my website, in order to load diferent pages (to be multipage website) I have a main panel that has the id 'content-panel'.
When I want to load a diferent page I have a javascript function that is called 'loadPage' that loads the page (panel) that I want to the 'content-panel'.
But the page that I want to load has to have this code:
Ext.require(['*']);
Ext.onReady(function() {
...
var panel = Ext.Cmp('content-panel');
panel.add(loginPanel);
panel.layout.setActiveItem(loginPanel);
panel.doLayout();
panel.setLoading(false);
});
In this case it is loading the page/panel that is loginPanel, that is defined inside Ext.onReady
For me this is fine, I don't know of any other way of my website being multi-page.
But everytime that I want to go to a page it loads that page to the 'content-panel', even if it already been loaded before. I want a way to only add the page to 'content-panel' if it is not inside 'content-panel' items.
UPDATE:
Here is the loadPage
function swap(parent, replacement, url) {
var alpha = document.querySelector(parent);
var target = alpha.childNodes[0];
var omega = document.createElement(replacement);
omega.src = url;
omega.type = 'text/javascript';
alpha.replaceChild(omega, target);
}
function loadPage(panel, toPanel) {
toPanel.setLoading(true);
swap('head', 'script', panel);
}
it is used like this: loadPage('Ctl_base/view_admin/mainPage', Ext.getCmp('panel'));
I'm using CodeIgniter with ExtJS.
What I have already tried:
I want to do panel.add(loginPanel) only if the loginPanel doesn't exist.
I have tried:
if(panel.getComponent(loginScreen) == undefined) { panel.add(loginPanel); }
and it adds the component even when panel already has that component.
I have also tried:
function hasComponent(parent, child) {
parent.items.items.forEach(function(item) {
if(item == child){
return true;
}
});
return false;
}
if(!hasComponent(panel, loginPanel)) { panel.add(loginPanel); }
and it also doesn't work.
I have manage to tackle this question by putting and itemId on the panel that I want to load, and on panel.layout.setActiveItem(loginPanel); I have put panel.layout.setActiveItem('itemIdOfPanel');

IE 11 - onbeforeunload event calling twice

I am using extjs. i have written code to provide warning message before redirecting other page. Warning message looks like below image
after clicking on "leave this page", same popup comes again. then after clicking on "leave this page". Here is code below:
Ext.EventManager.on(window, 'beforeunload', warnOnExit, this);// This has on document load.
//function definition
function warnOnExit(e) {
if (!bSkipChangesCheck)
{
e.browserEvent.returnValue = LY.Global.Misc.g_strWarnOnExit;
}
}
To fix this I have change "warnonexit" function as below
function warnOnExit(e) {
if (!bSkipChangesCheck)
{
e.browserEvent.returnValue =LY.Global.Misc.g_strWarnOnExit;
disableCheck();
}
}
function disableCheck() {
bSkipChangesCheck = true;
setTimeout("enableCheck()", "20");
}
function enableCheck() {
bSkipChangesCheck = false;
}
This works for me.But the solution was not accepted by higher tech persons.
i want answers of below questions.
Is timeout is only solution of this? If there are any other solutions , Please provide me
Is this the actual bug on IE11?
Need help badly!!

Code working in chrome but not in firefox in extjs

I m trying to set value to combobox in extjs, this is working in chrome but not in firefox. I used the following code:
function callFromController(comboitemid,itemvalue) {
Ext.ComponentQuery.query(comboitemid)[0].setValue(itemvalue);
};
AS a general guidence I would use:
function callFromController(comboitemid,itemvalue) {
// make sure you add a # to your Id string or use Ext.getCmp insted.
var foundComponents = comboitemid && Ext.ComponentQuery.query(comboitemid);
if (foundComponents.length) {
// I would add to see in your console.log('foundComponents[0]=%o',foundComponents[0])
// to check the value of the found component
foundComponents[0].setValue(itemvalue);
}
};

How to call a angular controller kept in another file from a mvc partial view

Edit:- My project that is mvc-4 having lay out page that holds angular.js and bootstrap.js, bootstrap.js and the angularmodule.js. the layout is wrapped into the index page. For the first time in the left section all categories are loaded in the index page. When i click on the any category a partial page that has got all products are loaded in to the middle section of index. Now when i again click on the any of middle section product button that comes with all the product spectic customization returning a partial _customization page that is to load in the model pop up. so the below code is kept on the _customization partial page.
I have created some ng-controler.js file
that holds the following code
EposApp.controller("cntrlCustomization", function ($scope, getCustomization) {
$scope.ListCollection = getCustomization.customization;
$scope.total = 0;
$scope.chkUnchk = function (v) {
if (v.selectionState == 0) { v.selectionState = 1 }
some more code...
}
I have a _customization partial view in mvc with the following code.
<script src="~/Scripts/ngController/ngController.js"></script>
<script>
var customizationJson = #Html.Raw(Json.Encode(#Model))
console.log(JSON.stringify(customizationJson));
EposApp.factory('getCustomization', function () {
return {
customization: customizationJson
}
});
</script>
My problem is that the Epos.Contoller not getting called, although when i keep controller code direct to the partial view itseld it works fine.. could some body please help me with this whats the problem.

Resources