How to use the table/constants.STATUS.LOADED function in table

To help you get started, we’ve selected a few table examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vtex / react-jsonschema-table / src / reducers / items-reducer.js View on Github external
items.forEach((item, index) => {
        // Get the item from the list and sets the document attibute and changes the document Status to LOADED
        var initialItem = newState.source[index + rowStart]
        initialItem.document = item.document
        initialItem.status = STATUS.LOADED
      })
github vtex / react-jsonschema-table / src / reducers / items-reducer.js View on Github external
const { errors, notSavedIds } = action
      const newState = Object.assign({}, state, {
        isFetching: false,
        errors: errors,
      })
      console.log(newState.staging)
      const stagingIds = Object.keys(newState.staging)
      console.log('stagingIds:', stagingIds)
      for (const documentId of stagingIds) {
        console.log('documentId', documentId)
        if (notSavedIds && notSavedIds.includes(documentId)) {
          continue
        }
        const stagingItem = newState.staging[documentId]
        console.log('stagingItem', documentId)
        if (stagingItem.status === STATUS.LOADED) {
          const loadedItem = newState.source.find(
            item => item.document && item.document.id === documentId
          )
          loadedItem.document = Object.assign(
            {},
            loadedItem.document,
            stagingItem.document
          )
          delete newState.staging[documentId]
          newState.stagingItems = newState.stagingItems.filter(
            stagingId => stagingId !== documentId
          )
          continue
        }

        if (stagingItem.status === STATUS.NEW) {
github vtex / react-jsonschema-table / src / reducers / items-reducer.js View on Github external
loadedItem.document,
            stagingItem.document
          )
          delete newState.staging[documentId]
          newState.stagingItems = newState.stagingItems.filter(
            stagingId => stagingId !== documentId
          )
          continue
        }

        if (stagingItem.status === STATUS.NEW) {
          const newItem = Object.assign(
            {},
            { document: newState.staging[documentId].document },
            {
              status: STATUS.LOADED,
            }
          )
          newState.source.push(newItem)
          delete newState.staging[documentId]
          newState.stagingItems = newState.stagingItems.filter(
            stagingId => stagingId !== documentId
          )
          continue
        }

        if (stagingItem.status === STATUS.DELETED) {
          newState.source = newState.source.filter(
            item => item.document.id !== documentId
          )
          delete newState.staging[documentId]
          newState.stagingItems = newState.stagingItems.filter(