Useraccounts updated to Useraccounts:iron-routing - meteor

updated my meteor app and had useraccounts on it and it suddenly told me to install the useraccounts:iron-routing to use it with Iron Router...
Installed the package and now its telling me
W20150818-19:23:20.744(-6)? (STDERR) Error: changePwd route configured but enablePasswordChange set to false!
and won't start my app, but my AccountsTemplates.configure({ has all seted to true... here is the code:
//Routes
AccountsTemplates.configureRoute('changePwd');
AccountsTemplates.configureRoute('enrollAccount');
AccountsTemplates.configureRoute('forgotPwd');
AccountsTemplates.configureRoute('resetPwd');
AccountsTemplates.configureRoute('signIn');
AccountsTemplates.configureRoute('signUp');
AccountsTemplates.configureRoute('verifyEmail');
// Options
AccountsTemplates.configure({
defaultLayout: 'layout',
showForgotPasswordLink: true,
overrideLoginErrors: true,
enablePasswordChange: true,
sendVerificationEmail: false,
//enforceEmailVerification: true,
//confirmPassword: true,
//continuousValidation: false,
//displayFormLabels: true,
//forbidClientAccountCreation: false,
//formValidationFeedback: true,
//homeRoutePath: '/',
//showAddRemoveServices: false,
//showPlaceholders: true,
negativeValidation: true,
positiveValidation:true,
negativeFeedback: false,
positiveFeedback:true,
// Privacy Policy and Terms of Use
//privacyUrl: 'privacy',
//termsUrl: 'terms-of-use',
});
AccountsTemplates.configure({
showLabels: true,
negativeValidation: true,
negativeFeedback: true
});
AccountsTemplates.addField({
_id: "username",
type: "text",
displayName: "username",
required: true,
minLength: 5,
});
AccountsTemplates.removeField('email');
AccountsTemplates.addField({
_id: 'email',
type: 'email',
required: true,
displayName: "email",
re: /.+#(.+){2,}\.(.+){2,}/,
errStr: 'Invalid email',
});
AccountsTemplates.removeField('password');
AccountsTemplates.addField({
_id: 'password',
type: 'password',
required: true,
minLength: 6,
re: /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/,
errStr: 'At least 1 digit, 1 lowercase and 1 uppercase',
});
any help?
Thnx

Try moving AccountTemplates.configure BEFORE AccountTemplates.configureRoute in your file. Also make sure whatever file those are in is accessible to both the client and server.

Related

pass parameter from Ext JS button handler

How to get username and password value from my button handler? When I code like this, I got error Uncaught ReferenceError: username is not defined
var auth = new Ext.FormPanel({
labelWidth : 75,
frame : true,
width : 320,
autoHeight : true,
defaultType : 'textfield',
monitorValid : true,
defaults : {
anchor : '-10'
},
items:[{
fieldLabel : 'Username',
id : 'username',
allowBlank : false
},{
fieldLabel : 'Password',
id : 'password',
inputType : 'password',
allowBlank : false
}],
buttons:[{
text : 'OK',
handler: penggabunganRm(username, password)
}]
});
var createWindow = new Ext.Window({
title : 'Input username and password',
width : 330,
autoHeight : true,
modal : true,
border : false,
layout : 'fit',
items : auth
});
createWindow.show();
function penggabunganRm(username, password){
if(username=='test' && password=='test'){
}
}
I want to get value of username and password to penggabunganRm() function.
Thank you
See this code below:-
var auth = new Ext.FormPanel({
labelWidth: 75,
frame: true,
width: 320,
autoHeight: true,
defaultType: 'textfield',
monitorValid: true,
defaults: {
anchor: '-10'
},
items: [{
fieldLabel: 'Username',
id: 'username',
name: 'username',
allowBlank: false
}, {
fieldLabel: 'Password',
id: 'password',
name: 'password',
inputType: 'password',
allowBlank: false
}],
buttons: [{
text: 'OK',
handler: function () {
penggabunganRm(this);
}
}]
});
var createWindow = new Ext.Window({
title: 'Input username and password',
width: 330,
autoHeight: true,
modal: true,
border: false,
layout: 'fit',
items: auth
});
createWindow.show();
function penggabunganRm(button) {
console.log(button.up('form').getValues());
if (username == 'test' && password == 'test') {};
}
Working Example
I have used name config both username and password fields.
Hope this will help/guide you.

when exporting to excel JqGrid,I Get error "TypeError: b.url is null "

I use jqGrid v5.3 in my asp.net MVC Project(Guriddo jqGrid JS - v5.3.0 - 2018-02-
01)
grid work in a good way ,every think is good
but when I want export grid to excel,I get this error:
TypeError: b.url is null
how can I solve that?
I using "jquery-2.1.1" and add these scripts to my projects:
<script src="~/Scripts/jqgrid/js/i18n/grid.locale-en.js"></script>
<script src="~/Scripts/jqgrid/js/jquery.jqGrid.min.js"></script>
<script src="~/Scripts/jqgrid/src/grid.export.js"></script>
and here is my JavaScript code:
$(document).ready(function () {
debugger;
LoadCustomerOrders();
});
function LoadCustomerOrders() {
// Make sure IE allows us to load JSON data from the iNorthwind website
jQuery.support.cors = true;
// Load our JSON data, and populate the jqGrid control with it
$("#tblOrders").jqGrid({
url: 'http://www.inorthwind.com/Service1.svc/getOrdersForCustomer/BERGS',
contentType: "application/json",
datatype: "json",
data: "{}",
jsonReader: {
root: "GetOrdersForCustomerResult", //arry containing actual data
id: "OrderID", //index of the column with the PK in it
repeatitems: false
},
mtype: "GET",
colNames: ["ID", "Order Date", "Name",
"Address", "City", "Postcode", "Shipped Date"],
colModel: [
{ name: "OrderID", width: 70, align: "center", search: false },
{ name: "OrderDate", search: true, width: 100 },
{ name: "ShipName", search: true, width: 120 },
{ name: "ShipAddress", search: true, hidden: true },
{ name: "ShipCity", search: true, width: 200 },
{ name: "ShipPostcode", search: true, width: 140 },
{ name: "ShippedDate", search: true, width: 80, align: "center" }
],
pager: "#pager",
width: 'auto',
height: 'auto',
rowNum: 10,
rowList: [],
loadonce: true,
sortable: true,
sortname: "OrderID",
sortorder: "desc",
viewrecords: true,
gridview: true,
autoencode: true,
ignoreCase: true, // Make the "Search" popup search case-insensitive
caption: ""
});
$('#tblOrders').jqGrid('navGrid', '#pager', {
search: true,
searchtext: "Search", // Make the Search icon have a "Search" label next to it
edit: false,
add: false,
del: false,
refresh: false
},
{}, // default settings for edit
{}, // default settings for add
{}, // delete
{
closeOnEscape: true, closeAfterSearch: true, ignoreCase: true, multipleSearch: false, multipleGroup: false, showQuery: false,
sopt: ['cn', 'eq', 'ne'],
defaultSearch: 'cn'
}).navButtonAdd('#pager', {
caption: "Export to Excel",
buttonicon: "ui-icon-disk",
onClickButton: function () {
ExportDataToExcel("#tblOrders");
},
position: "last"
});
}
function ExportDataToExcel(tableCtrl) {
// Export the data from our jqGrid into a "real" Excel 2007 file
// ExportJQGridDataToExcel(tableCtrl, "CustomerOrders.xlsx");
var gridData = $("#tblOrders").jqGrid('getRowData');
var dataToSend = JSON.stringify(gridData);
jQuery("#tblOrders").jqGrid('excelExport', dataToSend);
}
I think you use not the correct method to export the data to excel using Guriddo jqGrid. You use excelExport, which only send a parameters to the server and expect a export to be done at server. You need to use the exportToExcel method instead. Here is the documentation. Please look at this example
One more additional note - you do not need to include the grid.export.js file. This file is already included into the jquery.jqGrid.min file which you use.

How to delete multiples registers in jqgrid using asp.net mvc?

Could you please help me how I could do to delete multiple records selected in my jqgrid? I've tried a number of ways, but so far not got any success. I will be grateful to anyone who can help me.
jQuery("#grid-table").jqGrid({
//direction: "rtl",
url: "/Lojas/GetLojas",
datatype: 'json',
mtype: 'Get',
height: '100%',
colNames: [ ' ',
'Name',
'Description'
],
colModel: [
{
name: 'myac', index: '', width: 65, fixed: true, sortable: false, resize: false,
formatter: 'actions',
formatoptions: {
keys: true,
delOptions: { recreateForm: true, url: '/Lojas/Delete', beforeShowForm: beforeDeleteCallback },
editformbutton: true, editOptions: { recreateForm: true, url: '/Lojas/Edit', closeAfterEdit: true, beforeShowForm: beforeEditCallback, closeOnEscape: true }
}
},
{ key: true, hidden: true, name: 'Id', index: 'Id', sorttype: "int", editable: false },
{ key: false, name: 'Name', index: 'Name', editable: true},
{ key: false, name: 'Description', index: 'Description', editable: true}
],
viewrecords: true,
loadonce: true,
rowNum: 10,
rowList: [5, 10, 15],
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records",
repeatitems: false,
Id: "0"
},
pager: pager_selector,
altRows: true,
autowidth: true,
multiselect: true,
multiboxonly: true,
sortorder: "desc",
multiboxonly: true,
caption: "Lojas Cadastradas"
});
//navButtons
jQuery("#grid-table").jqGrid('navGrid', pager_selector,
{
edit: true,
add: true,
del: true,
search: true,
refresh: true,
view: true,
},
{
url: '/Lojas/Edit',
closeOnEscape: true,
closeAfterEdit: true,
recreateForm: true
},
{
url: '/Lojas/Create',
closeOnEscape: true,
closeAfterAdd: true,
recreateForm: true
},
{
url: '/Lojas/Delete',
closeOnEscape: true,
closeAfterDelete: true,
recreateForm: true
},
{
//search form
recreateForm: true,
closeOnEscape: true,
closeAfterSearch: true,
multipleSearch: true
},
{
//view record form
recreateForm: true
}
)
Code in my controller:
public ActionResult Delete(Loja loja)
{
Loja lojaToDelete = db.Lojas.Find(loja.Id);
if (lojaToDelete == null)
{
return HttpNotFound();
}
db.Lojas.Remove(lojaToDelete);
db.SaveChanges();
return View(loja);
}
I recommend you to change prototype of Delete function public ActionResult Delete(Loja loja) to
public void Delete(string id)
The main problem in your code is the following. Corresponds to the documentation jqGrid post id parameter to url: '/Lojas/Delete'. You can rename the name of id parameter using prmNames. In the case you can use prmNames: {id: "Id"}, but it's not really required.
If multiple rows needed be deleted then id string will be comma separated and you can use something like
public void Delete(string id)
{
var ids = id.Split(',');
foreach (lojaId in ids) {
Loja lojaToDelete = db.Lojas.Find(lojaId);
if (lojaToDelete == null)
throw new HttpResponseException(HttpStatusCode.NotFound);
db.Lojas.Remove(lojaToDelete);
}
db.SaveChanges();
}

jqGrid: How To Delete Row/s From "navButtonAdd" And "delGridRow"?

I've encountered a problem with jqGrid datagrid.
I need to delete one row or more with a button "Delete".
Here my code:
$grid.navGrid('#pager', { edit: false, add: false, del: false, search: false });
$grid.navButtonAdd('#pager', {
caption: "Delete",
buttonicon: "ui-icon-del",
position: "last",
onClickButton: function() {
alert("Deleting Row");
row_ids = $grid.getGridParam('selarrrow');
$grid.delGridRow(row_ids, {
dataType: 'json',
mtype: 'GET',
url: '<?php echo $_SERVER['PHP_SELF'].'?app=my_app&action=record_delete'; ?>'
});
}
});
This snippet of code send to the "url:" option the id/s of selected row/s (it works).
That url return a response, in json format.. This answer say if the operation was successful or not.
I need to display an alert with that message, how do I do?
And, another problem, when I click on "Delete" button (on bottom of the jqGrid), it displays an ajax windows with the question "Do you want to delete selected items?", with the "Yes" input and the "No" input. When I click "Yes", this ajax window will not close!
Thank you!
Dante
EDIT [1] && [2]
$(document).ready(function()
{
$grid = $("#list");
fixPositionsOfFrozenDivs = function() {
if (typeof this.grid.fbDiv !== "undefined") {
$(this.grid.fbDiv).css($(this.grid.bDiv).position());
}
if (typeof this.grid.fhDiv !== "undefined") {
$(this.grid.fhDiv).css($(this.grid.hDiv).position());
}
};
$grid.jqGrid({
url: '<?php echo $_SERVER['PHP_SELF'].'?app=my_app&option=get_records'; ?>',
datatype: 'json',
mtype: 'GET',
height: 'auto',
width: window.innerWidth-35, //width: '1225',
colNames: ['ID', 'Column A', 'Column B', 'Column C', 'Column D'],
colModel: [
{ name: 'id', index: 'id', width: 130, align: 'center', search: true,
sortable: true, frozen: true, editable: true, edittype: 'text', formatter: 'showlink',
editoptions: { size: 130, maxlength: 50 }, stype: 'text' },
{ name: 'col_a', index: 'col_a', width: 250, align: 'left', search: true,
sortable: true, frozen: false, editable: true, edittype: 'text',
editoptions: { size: 250, maxlength: 40 }, stype: 'text' },
{ name: 'col_b', index: 'col_b', width: 120, align: 'left', search: true,
sortable: true, frozen: false, editable: true, edittype: 'text',
editoptions: { size: 120, maxlength: 40 }, stype: 'text' },
{ name: 'col_c', index: 'col_c', width: 100, align: 'right', search: true,
sortable: true, frozen: false, editable: true, edittype: 'text',
editoptions: { size: 100, maxlength: 40 }, stype: 'text' },
{ name: 'col_d', index: 'col_d', width: 100, align: 'right', search: true,
sortable: true, frozen: false, editable: true, edittype: 'text',
editoptions: { size: 100, maxlength: 6 }, stype: 'text' }
],
caption: 'Objects',
pager: '#pager',
sortname: 'id',
sortorder: 'ASC',
rowNum: 25,
rowList: [25, 50, 100, 200, <?php echo $totrecords; ?>],
loadonce: true,
gridview: true,
viewrecords: true,
rownumbers: true,
rownumWidth: 40,
toppager: true,
multiselect: true,
autoencode: true,
ignoreCase: true,
shrinkToFit: false,
loadComplete: function() {
$("option[value=<?php echo $totrecords; ?>]").text('All');
},
editurl: '<?php echo $_SERVER['PHP_SELF'].'?app=my_app&option=delete_records'; ?>'
});
$grid.jqGrid('filterToolbar', {multipleSearch: false, stringResult: false, searchOnEnter: false, defaultSearch: 'cn'});
$grid.navGrid('#pager', { edit: false, add: false, del: false, search: false });
$grid.navButtonAdd('#pager', {
caption: "Delete",
buttonicon: "ui-icon-del",
position: "last",
onClickButton: function() {
row_ids = $grid.getGridParam('selarrrow');
$grid.delGridRow(row_ids, {
closeOnEscape: true,
mtype: 'POST',
afterSubmit: function(data_from_server, array_data) {
var result = data_from_server.responseText;
var message = eval('(' + result + ')');
alert(message.query);
}
});
}
});
$grid.jqGrid('setFrozenColumns');
$grid[0].p._complete.call($grid[0]);
fixPositionsOfFrozenDivs.call($grid[0]);
});
You should be able to use the afterSubmit event to display your message. From the jqGrid documentation:
afterSubmit
fires after response has been received from server. Typically used to display status from server (e.g., the data is successfully deleted or the delete cancelled for server-side reasons). Receives as parameters the data returned from the request and an array of the posted values of type id=value1,value2.
When used this event should return array with the following items [success, message]
where success is a boolean value if true the process continues, if false a error message appear and all other processing is stopped.
afterSubmit : function(response, postdata)
{
…
return [succes,message]
}
Regarding your second problem, I am not sure why the Ajax window will not close. Have you debugged the code to see if you are receiving a JavaScript error at that time? If not, it may be necessary for you to post a small example demonstrating the problem.
It's not good to use HTTP GET for delete operation. Do you want that the previous server response on the same URL will be cached and not send to the server? Default value of mtype is 'POST'. If you have RESTfull services on the server side you will need to use mtype: 'DELETE', but the usage of 'GET' can have sense only for the some dummy code which don't delete anything on the server.
Moreover you use dataType: 'json' parameter which is not exist for delGridRow (see the documentation). Even if you would use ajaxDelOptions: { datyType: "json" } you will get the server response (see the answer of Justin) not automatically converted from JSON to object. The reason is that the current code of delGridRow use complete callback instead of success callback (see here). So if you get JSON response from the server you will have to call $.parseJSON explicitly inside of afterSubmit callback (see the Justin's answer).

jqGrid loading aspx webservice using mtype post json not loading grid

I have been struggling with getting this to work for a number of days now.
oddly , I have gotten it to sort of work through various trials - but now its not loading at all
here is my setup:
$("#table-Select").jqGrid({
url: 'SelectionListService.asmx/GetList',
mtype: 'POST',
datatype: 'json',
ajaxGridOptions: { contentType: 'application/json; charset=utf-8' },
postData: { SelectionType: 'Project' },
colNames: ['id', 'Title', 'DocumentID'],
colModel: [
{ name: 'id', index: 'id', width: 20,hidden: false },
{ name: 'Title', index: 'Title' ,width: 220,hidden:false},
{ name: 'DocumentID', index: 'DocumentID',width: 220, hidden: false}
],
hidegird: false,
autowidth: true,
//height: 'auto',
rowNum: 0,
rowList: [10, 20, 30],
pager: jQuery('#table-SelectPager'),
sortname: 'Title',
viewrecords: true,
loadonce: true,
sortorder: "desc",
caption: "Select Project",
//fixes Invalid JSON Primitive error
serializeGridData: function (postData) {
if (postData.searchField === undefined) postData.searchField = null;
if (postData.searchString === undefined) postData.searchString = null;
if (postData.searchOper === undefined) postData.searchOper = null;
//if (postData.filters === undefined) postData.filters = null;
return JSON.stringify(postData);
},
jsonReader: {
root: "rows",
page: "page",
total: "total",
records: "records"
}
}).navGrid('#table-SelectPager', { edit: false, add: false, del: false });
Here is the JSON data coming from the WebService call :
{"d":{"__type":"NCR.SelectionListService+JQGrid","page":1,"total":4,"records":4,"rows":[{"id":"1","DocumentID":"pgmprj://aecomme/newdohaportproject/envcomp","Title":"NDPP-Environmental Compliance Monitoring"},{"id":"2","DocumentID":"pgmprj://aecomme/newdohaportproject/ndpp-portbasinandinnerbreakwatersconstruction","Title":"NDPP-Port Basin and Inner Breakwaters Construction"},{"id":"3","DocumentID":"pgmprj://aecomme/newdohaportproject/ndpp-programmanagement","Title":"NDPP-Program Management"},{"id":"4","DocumentID":"pgmprj://aecomme/newdohaportproject/ndpp-supplementarysiteinvestigation","Title":"NDPP-Supplementary Site Investigation"}]}}
I know it must be something simple i am missing - but after all of the examples I have looked at - I have no idea what I am missing.
Any thoughts would be greatly appreciated.
You should modify the jsonReader option to the following:
jsonReader: {
root: "d.rows",
page: "d.page",
total: "d.total",
records: "d.records",
repeatitems: false
}
See the demo.

Resources