Open Grart opened 5 years ago
serialize array object must be PlainObject?that is why?
demo 1: ` class Info { FieldName: string = null; Desc: boolean = false; }
const _info = new Info(); _info.FieldName = "abc"; _info.Desc = true; let _obj = { qModel: { SortInfoArray: [_info] } };
` form data: qModel[SortInfoArray][0][]: abc qModel[SortInfoArray][0][]: true
demo 2: let _obj ={ qModel: { SortInfoArray: [{ FieldName: "abc", Desc: true }] } }; form data: qModel[SortInfoArray][0][FieldName]: abc qModel[SortInfoArray][0][Desc]: true
let _obj ={ qModel: { SortInfoArray: [{ FieldName: "abc", Desc: true }] } };
sorce code `
function serialize(params, obj, scope) { var array = isArray(obj), plain = isPlainObject(obj), hash; each(obj, function (value, key) { hash = isObject(value) || isArray(value); if (scope) { key = scope + '[' + (plain || hash ? key : '') + ']'; } if (!scope && array) { params.add(value.name, value.value); } else if (hash) { serialize(params, value, key); } else { params.add(key, value); } });
} `
I have same issue. It seems the plugin removes / stops whenever it reaches "{". The jQuery alternative does not do that.
serialize array object must be PlainObject?that is why?
demo 1: ` class Info { FieldName: string = null; Desc: boolean = false; }
` form data: qModel[SortInfoArray][0][]: abc qModel[SortInfoArray][0][]: true
demo 2:
let _obj ={ qModel: { SortInfoArray: [{ FieldName: "abc", Desc: true }] } };
form data: qModel[SortInfoArray][0][FieldName]: abc qModel[SortInfoArray][0][Desc]: truesorce code `
} `