Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Found a few bugs when loading via server side ajax

Abierto
#7 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
javascript
Área
frontend

Línea de trabajo

Comienza con StateRestore.ts, líneas 751-758, y StateRestoreCollection.ts, líneas 641-647 y 878. Reproduce el escenario de actualización usando los ejemplos de ajax enlazados y comprueba si los estados cargados se pueden actualizar y si se ejecuta el callback de carga con estilo de función. Se considera terminado cuando los estados cargados desde el servidor conservan el estado predefinido correcto y el comportamiento de actualización documentado funciona después de actualizar.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Have been having issues trying to get StateRestore to load all states via server side Ajax call

using the function style ajax calls per See Here to control all the server side saving

I have never seen if (data.action === 'load') option ever fire... so I resorted to using the ajax stateRestore option on initial load
as See Here

Everything works until browser refresh and then you can't update any of the existing based on this area in StateRestore.ts (line 751-758)

//If the state is predefined there is no need to save it over ajax or to local storage
if (this.s.isPreDefined) {
	if (passedSuccessCallback) {
		passedSuccessCallback.call(this);
	}
	return;
}

what occurs is all the states are set to isPreDefined: true even for ajax loading

There is also a typo in StateRestoreCollection.ts where you in line 641-647

currState.stateRestore = {
isPredefined: false,
state: id,
tableId: this.s.dt.table().node().id
};

It s/b isPreDefined not isPredefined

I looked at your source code and I don't ever see a callback for the load process, and all the function Ajax examples don't ever load server side.

Your above initialisation/ajax.html example fails the same way

Steps:
1: Load a new state and try all the options (Rename, Update, Remove) they all fire a callback to server
2: Keep at least one state and re-fresh browser.
3: You can do all options except Update (check and all the loaded states are now IsPreDefined)

In my case, I never have preDefined: in the DataTable settings... so I turned off the true condition in StateResotrCollection.ts
_addPreDefined (line 878)

So in closing,
A) is there a way to load via function call Ajax from the server or
B) you should change the _addPreDefined call to add a boolean to set that isPreDefined to false for Ajax loads

Thanks

Lenguaje dominante
JavaScript
Estrellas
3
Forks
2
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DataTables/StateRestore

Todos los issues de DataTables/StateRestore

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.