ERROR : Uncaught TypeError: Cannot read property 'prop' of undefined
hello, except the status of my multiselec filter and then reload them, but when I reload but it gives me this error, can you help me please? Here
The error is coming from the multipleSelect plugin - so you need to look there. It's probably because your code isn't checking that something has been set before trying to reselect.
Try placing a console.log statement in stateLoadParams to see what data contains and you will find that on initial load it doesn't contain the properties shr_Position and shr_Office. For example: http://live.datatables.net/hamifadi/1/edit
You will need to check (using if) for the existence of those properties. If they exist you can use the code the ...multipleSelect('setSelects'... code.
when active on stateSaveParams:
data.shr_Position = $('#shrMulPosition').multipleSelect('getSelects');
the plugin Multiselect go Error (NOT WORK)
I believe that the only system is to manually save via an onclick event and reload the saved parameters via onAfterCreate, but how do I save them and read them manually ??
See Here
As you noted, it seems the problem is that the state load runs before initComplete. As Colin mentioned you can get the values in stateLoadParams and save to global variables, for example. Then in initComplete use those variables to set the selects.
From a state save and load perspective I think what you are doing is fine. As far as the Multi Select API it looks right according the the quick look I took at the docs. You will need to refer to those for specifics regarding that plugin.
The problem is you are trying to set the multi select with ...multipleSelect('setSelects'... before it has been initialized in the stateLoadParams function. Instead of setting it there just save the two values to global variables that you can access in initComplete and use the ...multipleSelect('setSelects'... after you init the multiselect.
Replies
Hi @Massimo74 ,
The error is coming from the multipleSelect plugin - so you need to look there. It's probably because your code isn't checking that something has been set before trying to reselect.
Cheers,
Colin
sorry but as a sequence together first stateLoadParams or initComplete could be that it doesn't find the multiselect as it is in initcomplete?
Yep, that would do it. So you could store the values in the
stateLoadParams
, and apply them to themultipleSelect
plugin in theinitComplete
.Try placing a console.log statement in stateLoadParams to see what
data
contains and you will find that on initial load it doesn't contain the propertiesshr_Position
andshr_Office
. For example:http://live.datatables.net/hamifadi/1/edit
You will need to check (using
if
) for the existence of those properties. If they exist you can use the code the...multipleSelect('setSelects'...
code.Kevin
when active on stateSaveParams:
data.shr_Position = $('#shrMulPosition').multipleSelect('getSelects');
the plugin Multiselect go Error (NOT WORK)
I believe that the only system is to manually save via an onclick event and reload the saved parameters via onAfterCreate, but how do I save them and read them manually ??
See Here
As you noted, it seems the problem is that the state load runs before initComplete. As Colin mentioned you can get the values in stateLoadParams and save to global variables, for example. Then in initComplete use those variables to set the selects.
Kevin
thanks kevin, I understood the problem but in fact my question was exactly how I saved and I read the values ?? do you have an example?
From a state save and load perspective I think what you are doing is fine. As far as the Multi Select API it looks right according the the quick look I took at the docs. You will need to refer to those for specifics regarding that plugin.
The problem is you are trying to set the multi select with
...multipleSelect('setSelects'...
before it has been initialized in the stateLoadParams function. Instead of setting it there just save the two values to global variables that you can access in initComplete and use the...multipleSelect('setSelects'...
after you init the multiselect.Kevin