Read value from search request Datatable? - datatables

I am trying to read value from search box of Datatable.
This is request payload:
[Object: null prototype] {
draw: '8',
'columns[0][data]': '_id',
'columns[0][name]': '',
'columns[0][searchable]': 'true',
'columns[0][orderable]': 'true',
...
start: '0',
length: '50',
'search[value]': 'id3dsd3dsdddsddsd',
'search[regex]': 'false'
}
I want to get value from search[value]. I get this error after using this code:
req.body.search.value
TypeError: Cannot read properties of undefined (reading 'value')
Anyone can help me!

Hope this would solve your problem.
let search_str = req.body['search[value]'];

Related

React native how to update multiple state values

Here is the user details which I want to update values when user enters data in Textinput
const [details, setDetails] = React.useState({
isValidName: true,
isValidMobile: true,
isValidEmail: true,
isValidGSTIN: true,
isValidPAN: true,
name: '',
mobile: '',
email: '',
company: '',
baddr1: '',
baddr12: '',
bcity: '',
bpincode: '',
bstate: ' TAMIL NADU',
bcountry: 'INDIA',
saddr1: '',
saddr2: '',
sbranch: '',
sgstin: '',
scity: '',
spincode: '',
sstate: '',
scountry: '',
pan: '',
gstin: '',
userlevel: '',
});
//In this method i am updating values each time when user enters data
const submitBillAddress = (data, type) => {
console.log('bill', type);
switch(type){
case 'addr1':
setDetails((prevState)=>{
return({
...prevState,
baddr1: data
});
});
break;
}
console.log('billdetails', details);
};
return (
<View>
<TextInput
style={styles.TextInputStyleClass}
placeholder="Address Line 1"
value={sameAddress?null:details.baddr1}
onChangeText={val => submitBillAddress(val, 'addr1')}
/>
</View>
)
I am new to React Native application development and I know this question is basic but I am not getting exact output. Here I have one Textinput in which I am entering data that I wanted to store in details.
The issue is if I enter data in textinput it's not updating value in details. Let's say I am entering 'C' in Textinput if I try to check the value in console the value of details.baddr1='' it's empty, Second time if I enter value 'H' on that time in console the value of details.baddr1='C'. Instead of showing the value details.baddr1='CH' it's showing previously entered value.
How can I fix this issue?
I'm guessing this is for a form of some sort. In that case, a package is your best bet I believe. While what you're trying to achieve is possible without a package, using a package is far less painful in the long run for your app.
Please check out formik or react-hook-form.
They're both decent.

vue-i18n this.$tc is not a function

My lang file:
AccountNotifications: {
createdWithName: 'Account «{account}» created',
created: 'Account created | Accounts created',
}
my submit method
submit()
this.$notifications.add({
type: 'success',
html: accounts.length === 1
? this.$tc('AccountNotifications.created', 1)
: this.$tc('AccountNotifications.created', 2),
});
My output
app.js:290949 TypeError: this.$tc is not a function
Whats wrong?
$tc() is not actually needed. The $t() function supports pluralization now.

Error while executing Postman Test Script

I am writing the Postman test cases. I am getting an error from following test-case
pm.test("Response to have expected data", function () {
pm.expect(documentIdArray).to.have.members(['5868', '4', '5874']);
});
There was an error in evaluating the test script: Error: expected [ '4837', '4', '5874' ] to have the same members as [ '5868', '4', '5874' ]
I think you are having string in documentIdArray. You can parse it:
pm.test("Response to have expected data", function () {
pm.expect(JSON.parse(documentIdArray)).to.have.members(['5868', '4', '5874']);
});
Else stringify the array and compare ( Recommended ) as the end point is not actually returning array but string it should be a bug
pm.test("Response to have expected data", function () {
pm.expect(documentIdArray).to.be.equal(JSON.stringify(['5868', '4', '5874']));
});

how helpers.translate('SOME_KEY') works?

I am wondering that how helpers.translate('SOME_KEY'); works in protractor?
i am using it like:
expect(element(by.css('.contact_tag')).getText()).toEqual('CONTACT');
here 'CONTACT' string translated in English as 'contact details'. i am getting the following output
output:
Expected 'contact details' to equal Object({ $$state: Object({ status: 0 }), catch: Object({ }), finally: Object({ }), then: Object({ }) }).
somebody please explain me that how this helpers.translate works? from where it takes this CONTACT translate string?

How to add to a store of a combobox in extjs 4?

I have tried the following from various examples and none of them work:
folderCombo.store.add({text: 'All', value: 'ALL'});
folderCombo.getStore.add({text: 'All', value: 'ALL'});
folderCombo.getStore().add(new grid.store.recordType({text: 'All', value: 'ALL'}));
folderCombo.store().add(new grid.store.recordType({text: 'All', value: 'ALL'}));
folderCombo.getStore().add(folderCombo.getStore().recordType({text: 'All', value: 'ALL'}));
Where folderCombo is my combobox. If I console.log folderCombo.store it shows the current store but never the store with the extra data item I try to add above.
Please advise.
Try:
folderCombo.getStore().add({text: 'All', value: 'ALL'});
or:
folderCombo.getStore().loadData({text: 'All', value: 'ALL'},true);